我的程序如下:
编译成功,当执行的时候PORTB就输出了一个0x00,中断程序不能执行
是不是我在那方面搞错了
请给指教!
#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
int counter;
void main(void) {
TSCR2=0X85;
TSCR1=0X80;
DDRB=0Xff;
PORTB=0X00;
counter=0;
EnableInterrupts;
for(;;);
}
#pragma CODE_SEG NON_BANKED
void interrupt tt(void) {
TSCR2=0x03;
for(;;){
while(TCNT!=0);
while(TCNT==0);
counter++;
if (counter == 8) PORTB = 0x7e;
if (counter == 7) PORTB = 0xbd;
if (counter == 6) PORTB = 0xdb;
if (counter == 5) PORTB = 0xe7;
if (counter == 4) PORTB = 0xe7;
if (counter == 3) PORTB = 0xdb;
if (counter == 2) PORTB = 0xbd;
if (counter == 1) PORTB = 0x7e;
if(counter==8)
counter=0;
}
} |