用的是单色的8*8点阵,行和列别离接在p0和p1口,完成作用比较牛逼.
#include#define uint unsigned int#define uchar unsigned charuchar code LED1[]={0x18,0x3c,0x7e,0xff,0x7e,0x3c}; uchar code LED2[]={0xe7,0xc3,0x81,0,0x81,0xc3,0xe7};uchar code su[]={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,140,130,120,110,100,90,80,70,60,50,40,30,20,};void delay(uint z);void main(){uint i=0,j=0; while(1){if(i==6){ i=0; j++;} P1=LED1[i];P0=LED2[i];i++;delay(su[j]);if(j==28)j=0;}}void delay(uint z) //延时函数{uint x,y;for(x=z;x>0;x--)for(y=110;y>0;y--);}