#include <reg52.h>
typedef unsigned char uint8;
sbit ENLED = P1^4;
sbit ADDR3 = P1^3;
sbit ADDR2 = P1^2;
sbit ADDR1 = P1^1;
sbit ADDR0 = P1^0;
sbit DB0 = P0^0;
void main()
{
unsigned char i,k,p,t,j;
char l;
unsigned char a[]={0,1,2,4,6,16,32,64};
unsigned char b[]={0,34,48,59,68,76,84,91,97,103,109,114,119,123,126};
signed char c[]={-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
ENLED=0;ADDR3=1;
ADDR0=0;ADDR1=1;ADDR2=1;
P0=0xFF;
while(1)
{
k=0;
for(i=0;i<=252;i++)
{
if(0==(i%4)) k++;
for(t=0;t<=16;t++)
{
DB0=0;
for(j=0;j<=64;j++)
if(j==k) DB0=1;
}
}
for(j=0;j<=254;j++)
{
p=0;
for(k=0;k<=15;k++)
{if(j==b[k]) l=c[k];}
for(i=0;i<=64;i++)
{
for(k=0;k<=7;k++)
{
if(i==a[k])
{
p=p|(1<<k);
t=~p;
if(l>=0)
P0=~(t<<l);
else
P0=~(t>>-l);
}
}
}
}
}
}