Hello, I need some help with the interrupt handling on a C-167 controller. In this case, the timer T3 is started (in Timer Mode) and works. The period time is about 1s, in this cycle comes the reset from the watchdog.. So, there is no access to the interrupt routine. See someone my mistake or the missing thing? Dietmar .... /* set Timer und Interrupt Register */ DP3_3 = 1; T3IC = 0x44; T3 = 0x0; IEN = 1; T3CON = 0x0646; /* start */ .... #include <reg167.h> /* special function register 80C167 */ void timer(void) interrupt 0x23 { P3_2 = !P3_2; }
I am not familiar with teh C167, but I guess, you have to do some sort of resetting the timer in your ISR. Just toggleing the port bit might not be enough. This is what I do at the end of my 80C51 (!) timer 0 ISR:
TR0 = 0; /* stop timer 0 */ TH0 = TH0_VAL; /* reload timer */ TL0 = TL0_VAL; TF0 = 0; /* reset timer 0 overflow flag */ TR0 = 1; /* start timer 0 */
Thanks for your response. I have done. void timer(void) interrupt 0x23 { _srvwdt_ (); T3CON = 0; /* Timer stop */ T3 = 0; /* reload */ T3IR = 0; /* clear interrupt request flaq */ P3_2 = !P3_2; T3CON = 0x0646; /* timer start */ } But, there is the same behavior. Every 1.5s comes the reset.. Dietmar
Again, a reply from a non-167 person. The code snippet has ABSOLUTELY no relation to the watchdog, unless the ISR (...) run for more than 1 sec in which case the watchdog is not the problem, but you are misusing an interrupt. The only thing that makes the dog bite is that it did not get kicked. Erik
Hi, In your code you are not assigning the reload value i.e timer value of 1s to the timer. What I mean to say is you have to assign the 1s timer value to T3 data register.
some thing like T3=0xCA;
hi ilu
fdss