电路图与程序如下;本意是按键控制数码管递增显示0-a,定时器控制led的闪烁
当按键按几次后LED就不闪了 不知道怎么回事,求大神指导
#include
#define uint unsigned int
#define uchar unsigned char
uint i=0;
uint count=0;
uint a=0;
sbit BUTTON=P3^0;
sbit LED=P2^1;
uchar graph[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77};
void delay(uint del)
{
uint z,j;
for(z=0;z
for(j=0;j<148;j++)
;
}
void ledshanshuo()
{
if(i==10)
{
LED=~LED;
i=0;
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
i++;
}
void init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
IE=0x82;
TR0=1;
}
void main()
{
init();
P0=graph[count];
while(1)
{
if(BUTTON==0)
{
delay(10);
if(BUTTON==0)
{
P0=graph[++count%11];
}
delay(500);
}
ledshanshuo();
}
}