用的是單色的8*8點陣,行和列分別接在p0和p1口,實現(xiàn)效果比較牛逼.#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) //延時函數(shù){uint x,y;for(x=z;x>0;x--)for(y=110;y>0;y--);}
評論