void display(uchar i)
{
uchar shi,ge;
shi = i / 10;
ge = i % 10;
P0 = 0xff;//???????
we = 1;
P0 = 0xfd;
we = 0;
du = 1;
P0 = leddata[shi];
du = 0;
delay(5);
P0 = 0Xff;//???????
we = 1;
P0 = 0xfb;
we = 0;
du = 1;
P0 = leddata[ge];
du = 0;
delay(5);
}
void init()
{
EA = 1;
TMOD = 0X11;
TH1 = TH0 = 0X4B;
TL1 = TL0 = 0XFC;
ET1 = ET0 = 1;
TR1 = TR0 = 1;
EX0 = 1;
IT0 = 0;
}
uint a,i,k;
void main()
{
P1 = 0x7f;
init();
a=10;
while(1)
{ a=10;
display(a);
}
}
之后的中断服务被我注解掉了,只有前面这段程序,为什么数码管开始会显示2。过段时间之后自动编程10 |