#include <reg52.h>
sbit ADDR2 = P1^2;
sbit ADDR1 = P1^1;
sbit ADDR0 = P1^0;
sbit ENLED = P1^4;
sbit ADDR3 = P1^3;
unsigned
char
code LedChar[16]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};
unsigned
char
LedBuff[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
void
delay_ms(unsigned
int
x)
{
unsigned
int
i,j;
if
(x==1000)
{
for
(i=0;i<19601;i++)
{
for
(j=5;j>0;j--);
}
}
else
while
(x--)
for
(j=115;j>0;j--);
}
void
main()
{
unsigned
char
Second=0;
ADDR3 = 1;
ENLED = 0;
ADDR2 = 0;
ADDR1 = 0;
ADDR0 = 0;
while
(1)
{
LedBuff[0]=LedChar[Second];
P0=0x7F & LedBuff[0];
Second++;
if
(Second>=10)Second=0;
delay_ms(1000);
}
}