MC9S08SG4 and interrupts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S08SG4 and interrupts

2,642 Views
jag
Contributor IV
Hello,
I'm porting a old program made for QY4 to the new SG4 chip.
I'm using CW6.1 without Processor Expert.

The question is:
how can I declare ISR (in C, no assembly, no PE)?

for QY it was something like:

#pragma TRAP_PROC
void ADC_Isr(void)
{
//code
}

and in the linker.prm the isr is declared like this:

VECTOR 16 ADC_Isr

For the SG4 I found no examples, and in the mc9s08sg4.h I found some #define that could be useful, but I've no idea how to use them.

Any help?

Thanks

Bye Jack
Labels (1)
Tags (1)
0 Kudos
5 Replies

526 Views
J2MEJediMaster
Specialist I
The same technique should work. Do you have the right header file for that particular MCU?

---Tom

0 Kudos

526 Views
jag
Contributor IV
Yes, it works thanks. Or at least it compile. I've not yet the board under my hands, so I can't try.

Another question:

I've found in an example (from another HCS08 processor) that is possible to declare interrupts like this:

__interrupt VectorNumber_Vadc void ADC_Isr(void)
{
    //code
}

where VectorNumber_Vadc is the interrupt vector number.
I think this is preferable, because with the other method I still need to edit the .prm file. Instead with this all the info needed for this interrupt are in .c files. So is more readable.

So what do you think? It's better to use #pragma TRAP_PROC or __interrupt?

Thanks

Bye Jack
0 Kudos

526 Views
J2MEJediMaster
Specialist I
I think both arrangments accomplish the same thing. See what works, and if you have a choice, then use the scheme that you prefer.

---Tom
0 Kudos

526 Views
bigmac
Specialist III
Hello Jack,
 
The various alternative methods available for implementing interrupt handlers within CW, are outlined in AN2616, within the FAQ section.
 
Regards,
Mac
 
0 Kudos

526 Views
jag
Contributor IV
Hi,
thanks to both.

Probably at the beginning the #pragma TRAP_PROC instruction didn't work because another error in the code :smileytongue:

Bye Jack
0 Kudos