#include <REGX51.H>
void delay (unsigned int ms)
{ unsigned int i;
unsigned char j;
for(i=0;i<ms;i++)
for(j=0;j<30;j++);{}
}
void main (void)
{
unsigned char x,y,d,l;
unsigned char AA[]={0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF};
unsigned char A[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
while (1)
{ P0=P1=P2=P3=0x00;
for (x=0;x<=3;x++)
for (y=0;y<=7;y++)
{
if (x==0) P1 = AA[y];
if (x==1) P2 = AA[y];
if (x==2) P3 = AA[y];
if (x==3) P0 = AA[y];
delay (1000);
}
for (d=0;d<=3;d++)
for (l=0;l<=7;l++)
{
if (d==0) P0 = A[l];
if (d==1) P3 = A[l];
if (d==2) P2 = A[l];
if (d==3) P1 = A[l];
delay (1000);
}
}
}
void delay (unsigned int ms)
{ unsigned int i;
unsigned char j;
for(i=0;i<ms;i++)
for(j=0;j<30;j++);{}
}
void main (void)
{
unsigned char x,y,d,l;
unsigned char AA[]={0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF};
unsigned char A[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
while (1)
{ P0=P1=P2=P3=0x00;
for (x=0;x<=3;x++)
for (y=0;y<=7;y++)
{
if (x==0) P1 = AA[y];
if (x==1) P2 = AA[y];
if (x==2) P3 = AA[y];
if (x==3) P0 = AA[y];
delay (1000);
}
for (d=0;d<=3;d++)
for (l=0;l<=7;l++)
{
if (d==0) P0 = A[l];
if (d==1) P3 = A[l];
if (d==2) P2 = A[l];
if (d==3) P1 = A[l];
delay (1000);
}
}
}
Comment