#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char //宏定义
#define uint unsigned int
sbit dl=P2^0;
sbit wl=P2^1;
uchar code table0[]={
0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
uchar code table[]={
0x00,0x00,0x00,0x18,
0x18,0x00,0x00,0x00};
uchar code table1[]={
0x00,0x00,0x3c,0x24,
0x24,0x3c,0x00,0x00};
uchar code table2[]={
0x00,0x7e,0x42,0x42,
0x42,0x42,0x7e,0x00,};
uchar code table3[]={
0xff,0x81,0x81,0x81,
0x81,0x81,0x81,0xff};
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=100;y>0;y--);
}
void main()
{
uchar i;
wl=1;
P1=0;
wl=0;
while(1)
{
P0=0XFF;
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table1;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table2;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table3;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table3;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table2;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table1;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
for(i=0;i<8;i++)
{
P1=0;
P0=table0;
delay(1);
P1=table1;
delay(1);
}
P0=0XFF;
P1=0;
delay(80);
}
}
文章评论(0条评论)
登录后参与讨论