HCS12 Interrupts

Started by tophongli April 10, 2007
Hello,

I am using IAR to develop a 9s12d64 based project. I am new to these
and am having problems with interrupts. .

In main program, I have the following init routine to turn realtime
interrupt on:
void rti_init (void)
{
RTICTL = 0x17; /* set RTI prescaler */
CRGINT = 0x80; /* Enable RTI interrupts */
}

In ISR, I have the following routine with a dead loop blinking the
LED.

#pragma vector = 0xFFF0
__interrupt void RTI_interrupt (void){
CRGFLG = 0x80; /* Clear Flag */
...
dead loop with LED blinking
...
}

For some reason, the program didn't go to ISR and I can see it still
running in main routine. I tried SCI interrupts and still nothing
happened.

Main routine:
__monitor void putch0 (char x)
{
SCI0CR2 |= 0x80; /* Enable SCI0 Interrupt */
SCI0CR2 |= 0x40 /* Added this one still no use */
}

ISR:
#pragma vector = 0xFFD6
__interrupt void SCI0_interrupt (void)
{
dead loop with LED blinking
}

When I add "__enable_interrupt();" in main routine, the program no
longer running in main routine. It goes to somewhere but still not in
my three interrupt service routines (RTI, SCI0, SCI1). Maybe it goes
to some other higher priority ones? I didn't set any priorities and
no any other service routines. Where it can go? I must have missed
something here. Anyone can help? Thanks a lot.

Best regards,
Hong