#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
sbit A1=P1^2;
sbit B1=P1^3;
sbit C1=P1^4;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void delayms(uchar x)
{
uint i,j;
for(i=x;i>0;i--)
for(j=120;j>0;j--);
}
void display()
{
uchar X,Y;
for(X=0;X<16;X++)
for(Y=0;Y<100;Y++)
{
A1=0;B1=0;C1=0;P2=table[X];delayms(3);
A1=0;B1=0;C1=1;P2=table[X];delayms(3);
A1=0;B1=1;C1=0;P2=table[X];delayms(3);
A1=0;B1=1;C1=1;P2=table[X];delayms(3);
A1=1;B1=0;C1=0;P2=table[X];delayms(3);
A1=1;B1=0;C1=1;P2=table[X];delayms(3);
A1=1;B1=1;C1=0;P2=table[X];delayms(3);
A1=1;B1=1;C1=1;P2=table[X];delayms(3);
}
}
void main()
{
while(1)
{
display();
}
} |