大佬们,这个中断里的循环老是进不去是怎么回事啊
include <REGX52.H>
unsigned char key=0;
unsigned int led[8]={
0x9F,0x07,0x01,0x80,0x80,0x01,0x07,0x9F};
sbit ADDR0=P1^0;
sbit ADDR1=P1^1;
sbit ADDR2=P1^2;
sbit ADDR3=P1^3;
sbit ADDR4=P1^4;
sbit ADDR5=P1^5;
sbit ADDR6=P1^6;
sbit ADDR7=P1^7;
void main()
{
ADDR3=1;
ADDR4=0;
TMOD=0x01;
TH0=0xfc;
TL0=0x66;
EA=1;
ET0=1;
TR0=1;
while(1)
{
}
}
void interruptTimer0() interrupt 1
{
TH0=0xdb;
P2=0xff;
TL0=0Xff;
switch(key)
{
case0:ADDR0=0;ADDR1=0;ADDR2=0;key++;P2=led[0];break;
case1:ADDR0=1;ADDR1=0;ADDR2=0;key++;P2=led[1];break;
case2:ADDR0=0;ADDR1=1;ADDR2=0;key++;P2=led[2];break;
case3:ADDR0=0;ADDR1=0;ADDR2=0;key++;P2=led[3];break;
case4:ADDR0=1;ADDR1=1;ADDR2=0;key++;P2=led[4];break;
case5:ADDR0=1;ADDR1=0;ADDR2=1;key++;P2=led[5];break;
case6:ADDR0=0;ADDR1=1;ADDR2=1;key++;P2=led[6];break;
case7:ADDR0=1;ADDR1=1;ADDR2=1;key++;P2=led[7];break;
default: break;
}
}
|