#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code LED_W[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void Delay(uint i)
{
uchar x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
void Main(void)
{
while(1)
{
P0 = 0;
P2 = LED_W[1];
P0 = table[1];
Delay(100);
P0 = 0;
P2 = LED_W[0];
P0 = table[2];
Delay(100);
}
}
|