AnsweredAssumed Answered

Register TIE & TSCR2 in MC9S12G Family

Question asked by Deepak Omanna on Oct 29, 2015
Latest reply on Oct 30, 2015 by Gordon S Doughman

Hi,

My aim is to generate 1msec timer interrupt.

The Device i am using is MC9S12G Family (MC9S12G128).

 

To get the 1msec interrupt I used channel 0 as a output compare and no output required on the pins. For this I configured following registers (other timer registers are set to default state),

TIOS = 0x01;

TC0 = 0x5D02; /* 1msec value for output compare, Bus clk = 24Mhz, Prescaler = 1 */

TSCR1 = 0xE0;

TIE = 0x01;

TSCR2 = 0x80;

 

Here Channel 0 will gives the interrupt after output compare value matches that is 1msec.

So here i am not understanding when will be Timer overflow interrupt occurs ? as I have enabled in TSCR2.

Also How to set the Timer Overflow Interrupt after every 1msec ? If i don't want to use channel registers or output compare.

 

ISR Functinos,

interrupt 8 void CH0_ISR(void)

{

Counter++;

TC0 = TC0 + 0x5D02;

TFLG1 = 0x01;       //clear interrupt flag

}

 

interrupt 16 void TOI_ISR(void)

{

    TFLG2 = 0x80;       //clear interrupt flag

}

 

Any help is appreciated.

Thanks.

Outcomes