我使用PIT中断,控制M口输出点灯,单步调试的时候发现没有进入中断,我是初学者,刚刚接触freescale,用的XDP512, 希望有人能指点一下,再初学的路上点亮一盏灯,帮我过了这道坎,感激不尽。 我的代码:#include <hidef.h> /* common defines and macros */ #include <mc9s12xdp512.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12xdp512" void SetupPITimer (void) {
/* time-out period = (PITMTLD0 + 1) * (PITLD0 + 1) / Fbus */ PITCFLMT = 0x81; /* PFLMT0=1 (reload MT0) */ PITFLT = 0x01; /* force reload of PIT channel 0 */ PITMUX = 0x00; PITCE = 0x01; PITINTE = 0x01; /* enable PIT channel 0 interrupt */ PITTF = 0x01; /* clear PIT interrupt */ PITMTLD0 = 0x02; /* MT0 load value (divides bus clock) */ PITLD0 = 0X0001; /* T0 load value (5 ms) */ PITCFLMT |= 0x80; } /********************************************************/ /*********************** main *********************************/ void main(void) { DDRM=0XFF; PTM=0x00; SetupPITimer();
EnableInterrupts;
for(;;) { } } /********************************************************/ /* interrupt handler for PIT 0 */ #pragma CODE_SEG __NEAR_SEG NON_BANKED void interrupt 73 ISR_PIT0(void) { PITINTE &= 0xfe; PITTF |= 0x01; PTM=~PTM; }
|