希望通过RTI中断实现走马灯的功能,程序如下
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b" void ECT_Init(void); void RTI_Init(void);
#pragma CODE_SEG NON_BANKED interrupt 7 void RTI_int(void) { CRGINT_RTIE=0;
PORTB=PORTB<<1; CRGFLG_RTIF=1; CRGINT_RTIE=1; EnableInterrupts; } #pragma CODE_SEG DEFAULT
void RTI_Init(void) { RTICTL=0x7f; CRGINT=0x80; //49hz }
void main(void) { DDRB=0xff; PORTB=0x01;RTI_Init(); EnableInterrupts; while(1){}; } 运行以后程序执行一次中断就不再进行了,请高手指点,多谢! |