Colin McGuire

HCS12 MC9S12E128 Interrupt Problem

Discussion created by Colin McGuire on Mar 9, 2008
Latest reply on Mar 11, 2008 by Tom Thompson
Hey guys,

I have been working using the C32 varient of the HCS12 OK and am quite comfortable with it. I have recently started using a E128 varient to take advantage of the I2C module but have been having trouble getting simple interrupts to work. As far as I can tell my code is fine.

Code:
#include <hidef.h>      /* common defines and macros */#include <mc9s12e128.h>     /* derivative information *//* Interrupt for TIM0_TC4 */void interrupt 12 timer0TC4(void) {  TIM0_TC4 += 512;  PTT ^= 0xFF;        /* Toggle LEDS */  TIM0_TFLG1_C4F = 1; /* Reset flag */ }void main(void) {  DDRT = 0xFF;  PTT = 0x00;    TIM0_TCTL1 = 0x00;    /* Take no action */  TIM0_TSCR1 = 0x80;    /* Enable counter */  TIM0_TSCR2 = 0x00;    /* No overlow flag/prescale */  TIM0_TIOS_IOS4 = 1;   /* Enable O/C Timer1 */    TIM0_TFLG1_C4F = 1;   /* Reset C4F flag */  TIM0_TIE = 0x10;      /* Enable interrupt on TC1 */    asm("SWI");  TIM0_TC4 = TIM0_TCNT + 512; /* Set value to interrupt */    for(;;) {}  }

 Does anyone see anything not right?

I am using code warrior, and using the simulation it appears my TCNT isnt even counting - probably the cause of nothing working.

Thanks again.

Colin



Message Edited by Deadstar on 2008-03-09 04:57 PM

Outcomes