I've done several projects on the 9S12XDP512 and in each case I've used the .prm file to specify the names of the interrupt handling functions.
/* use these definitions in plane of the vector table ('vectors') above */
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialization entry point */
VECTOR ADDRESS 0xFF78 PIT1_ISR
VECTOR ADDRESS 0xFF7A PIT0_ISR
VECTOR ADDRESS 0xFFD6 COM1Interrupt
VECTOR ADDRESS 0xFFD4 COM2Interrupt
This is all based on the original example code from the Softec Development board I started with.
The linker fills in the rest of the table with FFFF so a spurious interrupt should reset the application since the entry at that RESET vector is 0xC000.
Is there a better way to do this or should I care?
In the timer.c file I have:
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void PIT0_ISR(void) {
TickCount++;
PITTF = 0x01; | |
} |
#pragma CODE_SEG DEFAULT
In order to access the variable TickCount I disable interrupts since TickCount is a 16 bit variable and could change between reading it and clearing it.
// disable timer interrupts |
PITINTE &= DELAY_TIMER_DISABLE;
// Update local copy.
t_Delay = TickCount;
TickCount = 0;
// re-enable timer interrupts
PITINTE |= DELAY_TIMER_ENABLE;
Any comments on the above. Is there anything unique in the 9S12 family that I'm missing here? Specifically when I see the comments in the .prm file about OSEK etc.
ENTRIES /* keep the following unreferenced variables */
/* OSEK: always allocate the vector table and all dependent objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
END
Thanks
John
.
Solved! Go to Solution.
hi John. !
the interrupt vector address is correct in your code.
please perform interrupt per attached technical note.
==================================================
this answer is for you. if it helps, please click on "correct answer" button. thanks!
Best Regards,
ZhangJun