资源描述:
《8×8LED点阵引脚定义(自己总结).doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、8*8LED点阵引脚定义:涂黑为LED的正极参考例程:程序如下:#include"reg51.h"unsignedcharcodetab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsignedcharcodegraph[11][8]={{0x0,0x18,0x24,0x24,0x24,0x24,0x24,0x18},//0{0x0,0x8,0x18,0x8,0x8,0x8,0x8,0x8},//1{0x0,0x18,0x24,0x24,0x8,0x10,0x20,0x3C},//2{0x0,0x18,0x24,0x4,0x8,0x24,0
2、x24,0x18},//3{0x0,0x8,0x8,0x18,0x28,0x3C,0x8,0x8},//4{0x0,0x3C,0x20,0x38,0x4,0x4,0x24,0x18},//5{0x0,0x18,0x24,0x20,0x38,0x24,0x24,0x18},//6{0x0,0x3C,0x24,0x4,0x8,0x10,0x10,0x10},//7{0x0,0x18,0x24,0x24,0x18,0x24,0x24,0x18},//8{0x0,0x18,0x24,0x24,0x1C,0x4,0x24,0x18},//9{0x4C,0xD2,0x52,0x52,0x52,0x5
3、2,0x52,0xEC}*//10//{0x10,0xFE,0x92,0x92,0xFE,0x92,0x10,0x10},//中//{0xFE,0xBA,0x92,0xBA,0x96,0xFE,0x82,0xFE}//国};unsignedcharcount;unsignedcharcnta;sbitP35=P3^5;//按键开关定义voidmain(void){ unsignedchari,j; TMOD=0x01; TH0=(65536-3000)/256; TL0=(65536-3000)%256; TR0=1; ET0=1; EA=1; while(1) { if(P3
4、5==0) {for(i=5;i>0;i--) for(j=248;j>0;j--); if(P35==0) { count++; if(count==11)//当显示到10时,回到0 { count=0; } while(P35==0); } } }}voidt0(void)interrupt1using0{ TH0=(65536-3000)/256; TL0=(65536-3000)%256; P2=tab[c
5、nta]; P1=graph[count][cnta]; cnta++; if(cnta==8){cnta=0;}}