/********************************************************************************************LED点阵实验(左右上下流动显示)******************************************************************************************/#includeREG51.Hunsignedcharcodetaba[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsignedcharcodetabb[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};voiddelay1(void){unsignedchari,j,k;for(k=10;k0;k--)for(i=20;i0;i--)for(j=248;j0;j--);}voidmain(void){unsignedchari,j;while(1){for(j=0;j3;j++)////fromlefttoright3time{for(i=0;i8;i++){P2=taba[i];P0=0xff;delay1();}}for(j=0;j3;j++)////fromrighttoleft3time{for(i=0;i8;i++){P2=taba[7-i];P0=0xff;delay1();}}for(j=0;j3;j++)////fromtoptobottom3time{for(i=0;i8;i++){P2=0x00;P0=tabb[7-i];delay1();}}for(j=0;j3;j++)////frombottomtotop3time{for(i=0;i8;i++){P2=0x00;P0=tabb[i];delay1();}}}}