资源描述:
《026、点阵式LED简单图形显示技术.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、26.点阵式LED简单图形显示技术1.实验任务在8X8点阵式LED显示“★”、“●”和心形图,通过按键来选择要显示的图形。2.电路原理图图4.26.13.硬件系统连线(1).把“单片机系统”区域中的P1端口用8芯排芯连接到“点阵模块”区域中的“DR1-DR8”端口上;(2).把“单片机系统”区域中的P3端口用8芯排芯连接到“点阵模块”区域中的“DC1-DC8”端口上;(3).把“单片机系统”区域中的P2.0/A8端子用导线连接到“独立式键盘”区域中的SP1端子上;4.程序设计内容(1).“★”在8X8LED点阵上显示图如下图所示 1 2 3
2、4 5 678 ● ● ●●● ●●●●●●● ●●● ●● ●● ● ● 12H,14H,3CH,48H,3CH,14H,12H,00H(2).“●”在8X8LED点阵上显示图如下图所示1 2 34 5 678 ●●● ● ● ● ● ● ● ●●● 00H,00H,38H,44H,44H,44H,38H,00H(3).心形图在8X8LED点阵上显示图如下图所示1 2 34 5 678
3、 ●● ●● ● ● ● ● ● ● ● ● ● ● 30H,48H,44H,22H,44H,48H,30H,00H5.汇编源程序CNTAEQU30HCOUNTEQU31HORG00HLJMPSTARTORG0BHLJMPT0XORG30HSTART:MOVCNTA,#00HMOVCOUNT,#00HMOVTMOD,#01HMOVTH0,#(65536-4000)/256MOVTL0,#(65536-4000)MOD256SETBTR0SETBET0SETBEAWT:JB
4、P2.0,WTMOVR6,#5MOVR7,#248D1:DJNZR7,$DJNZR6,D1JBP2.0,WTINCCOUNTMOVA,COUNTCJNEA,#03H,NEXTMOVCOUNT,#00HNEXT:JNBP2.0,$SJMPWTT0X:NOPMOVTH0,#(65536-4000)/256MOVTL0,#(65536-4000)MOD256MOVDPTR,#TABMOVA,CNTAMOVCA,@A+DPTRMOVP3,AMOVDPTR,#GRAPHMOVA,COUNTMOVB,#8MULABADDA,CNTAMOVCA,@A+D
5、PTRMOVP1,AINCCNTAMOVA,CNTACJNEA,#8,NEXMOVCNTA,#00HNEX:RETITAB:DB0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,07FHGRAPH:DB12H,14H,3CH,48H,3CH,14H,12H,00HDB00H,00H,38H,44H,44H,44H,38H,00HDB30H,48H,44H,22H,44H,48H,30H,00HEND6.C语言源程序#includeunsignedcharcodetab[]={0xfe,0xfd,0x
6、fb,0xf7,0xef,0xdf,0xbf,0x7f};unsignedcharcodegraph[3][8]={{0x12,0x14,0x3c,0x48,0x3c,0x14,0x12,0x00},{0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00},{0x30,0x48,0x44,0x22,0x44,0x48,0x30,0x00}};unsignedcharcount;unsignedcharcnta;voidmain(void){unsignedchari,j;TMOD=0x01;TH0=(65536-4
7、000)/256;TL0=(65536-4000)%256;TR0=1;ET0=1;EA=1;while(1){if(P2_0==0){for(i=5;i>0;i--)for(j=248;j>0;j--);if(P2_0==0){count++;if(count==3){count=0;}while(P2_0==0);}}}}voidt0(void)interrupt1using0{TH0=(65536-4000)/256;TL0=(65536-4000)%256;P3=tab[cnta];P1=graph[count][cnta];cnt
8、a++;if(cnta==8){cnta=0;}}