This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interrupt handling

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;

}

Parents
  • 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 */
    

    Hope it helps a bit.

    Sven

Reply
  • 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 */
    

    Hope it helps a bit.

    Sven

Children
  • 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