#include<reg52.h>
void Init
timer0(void);
unsigned int code LedChar[]={
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,
0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e
};
void main()
{
unsigned int sec = 0;
while(1)
{
if(sec<=16)
{
P0=LedChar[sec];
InitTimer0();
sec++;
}
else
{
sec=0;
}
}
}
void InitTimer0(void)
{
TMOD = 0x01;
TH0 = 0x0FC;
TL0 = 0x18;
TR0 = 1;
}
为什么我的数码管一直都是停在8这个数字上没有变动?
一周热门 更多>