AnsweredAssumed Answered

S12G128 Timer Overflow Interrupt

Question asked by Ray Hall on Jul 3, 2015
Latest reply on Sep 18, 2018 by Lukman Kurniawan

I am trying to make a overflow timer interrupt to work. This is my code that just locks up when run. What am I going wrong ?

 

Ray.

 

void main(void) {

 

  DDRT = 0x30;

  PTT_PTT5 = 0x01;

 

  TSCR1 = 0x80;    // Enable Timer.with legacy prescaler

  TSCR2 = 0x80;   // Overflow Interrupt with 1 prescaler   

 

  EnableInterrupts;

 

  for(;;) {

 

  FEED_COP(); /* feeds the dog */

  } /* loop forever */

 

}

 

#pragma CODE_SEG NON_BANKED

interrupt 8 void TI1_Interrupt(void)

{

  TFLG1 = 0x01U;        // Reset interrupt request flag

  PTT_PTT5 = ~PTT_PTT5; //toggle LED on PT5 

}

 

#pragma CODE_SEG DEFAULT

Outcomes