#include<REG52.h>
#define uchar unsigned char
void Delay(void)
{
uchar x;
for(x=0;x<10;x++);
} uchar addr[4]_at_0x30;
uchar i,wSelect;
uchar code tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x76};
void main(void)
{
for(i=0;i<4;i++)
addr[i]=i;
while(1){wSelect=0xfe;
for(i=0;i<4;i++)
{
p2=0x0ff;
p0=tab[ addr[i] ];
p2=wordSelect;
Delay();
wSelect=(wSelect<<1)+1;
}
}
} |