|
已经实现了,延时1us
#include
#include
#define ui unsigned int
#define uc unsigned char
void delay(ui);
void inti();
sbit a4=P2^3;
sbit a3=P2^2;
sbit a2=P2^1;
sbit a1=P2^0;
uc code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
void main()
{ inti();
while(1)
{
a1=0;
P0=tab[1];
delay(1);
a1=1;
a2=0;
P0=tab[2];
delay(1);
a2=1;
a3=0;
P0=tab[3];
delay(1);
a3=1;
a4=0;
P0=tab[4];
delay(1);
a4=1;
}
}
void delay(ui z)
{
ui x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void inti()
{
TMOD=0x01;
TH0=0x3c;
TL0=0xb0;
EA=1;
ET0=1;
TR0=1;
} |
赞赏
-
1
查看全部赞赏
-
|