Hi,
It´s only 3 weeks since I started to work with a HCS12 family microcontroller (MC9S12C32+chipS12 demoboard) and I´m quite lost. I have been trying to make a program with interrupts, just a very simple one, which just waits for the RTI to be set before toggleing a led with it´s interrupt handler.
I have been reading a lot of stuff about that, but I don´t know if I have really understood it. What I have to do is (I´m programming with Imagecraft´s ICC12 compiler):
1- Define the interrupt handler in my c code file, like this
#pragma interrupt_handler timer_handler
...
void timer_handler()
{
...
}
2- Modify my vectors.c file like this:
#pragma abs_address:0xffd0
/* change the above address if your vector starts elsewhere*/
void (*interrupt_vectors[])(void) =
{
/* to cast a constant, say 0xb600, use (void (*)())0xb600*/
/* 812A4 vectors starts at 0xff80, but most entries are not used if you use Key Wakeup H, change the start address to 0xffCE and add one entry to the beginning */
DUMMY_ENTRY, /* BDLC */ /* Key Wakeup J */
DUMMY_ENTRY, /* ATD */ /* ATD */
DUMMY_ENTRY, /* RESERVED */ /* SCI 1 */
DUMMY_ENTRY, /* SCI */
DUMMY_ENTRY, /* SPI */
DUMMY_ENTRY, /* PAIE */
DUMMY_ENTRY, /* PAO */
DUMMY_ENTRY, /* TOF */
DUMMY_ENTRY, /* HC12 TC7 */
DUMMY_ENTRY, /* TC6 */
DUMMY_ENTRY, /* TC5 */
DUMMY_ENTRY, /* TC4 */
DUMMY_ENTRY, /* TC3 */
DUMMY_ENTRY, /* TC2 */
DUMMY_ENTRY, /* TC1 */
DUMMY_ENTRY, /* TC0 */
timer_handler, /* RTI */
DUMMY_ENTRY, /* IRQ */
DUMMY_ENTRY, /* XIRQ */
DUMMY_ENTRY, /* SWI */
DUMMY_ENTRY, /* ILLOP */
DUMMY_ENTRY, /* COP */
DUMMY_ENTRY, /* CLM */
_start /* RESET */
};
#pragma end_abs_address
Can anyone tell me if I´m right? and what I have to do with the "vectors.c" file? should I include (#include vectors.c) in my c code?
If anyone could tell where I can find some C coded examples it would be great.
THX in advance
M3H0