#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dt256b"
void tim_init (void) {
TIE = 0x01; // Enable Tim Ch. 0
TSCR1 = 0x80; // Enable Timer module
TSCR2 = 0x80;
TC0 = 0x0080;
}
void main(void) {
/* put your own code here */
DDRA = 0xFF;
PORTA = 0x00;
EnableInterrupts;
tim_init();
for(;;) {} /* wait forever */
/* please make sure that you never leave this function */
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt 8 void tim_ch0_vector(void) {
PORTA = 0x55;
TFLG2 = 0x80;
}
#pragma CODE_SEG DEFAULT
已解决! 转到解答。
Hello,
Using the ISR function declaration to set the interrupt vector number appears to be valid for the 9S08 (see AN2616 page 53) - but not sure about the 9S12. The method avoids the need to modify the .PRM file with the vector information.
Regards,
Mac