资源描述:
《8×8点阵数字滚动显示》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、项目一8×8点阵数字滚动显示LED点阵的元件符号及内部结构图:对应编码:00H,00H,00H,00H,00H,00H,00H,00H;NULL00H,00H,3EH,41H,41H,41H,3EH,00H;000H,00H,00H,00H,21H,7FH,01H,00H;100H,00H,27H,45H,45H,45H,39H,00H;200H,00H,22H,49H,49H,49H,36H,00H;300H,00H,0CH,14H,24H,7FH,04H,00H;400H,00H,72H,51H,51H,51H,4EH,00H;50
2、0H,00H,3EH,49H,49H,49H,26H,00H;600H,00H,40H,40H,40H,4FH,70H,00H;700H,00H,36H,49H,49H,49H,36H,00H;800H,00H,32H,49H,49H,49H,3EH,00H;900H,00H,00H,00H,00H,00H,00H,00H;NULL硬件设计原理:单片机利用外部晶振作为时钟信号输入,RST端口接入上电复位信号使它加电后自动进行复位操作。将要显示的字符码表编入单片机的程序中,由单片机控制时序输出相应的扫描数据和字符数据。行码数据由单片机P0
3、口输出,经一个双向总线收发器控制传输方向后进入LED点阵,点亮相应的发光二极管。列码扫描信号由P3口输出后,直接输入LED点阵控制8列的扫描,每列选通时间为5ms,看上去就像8列同时显示的效果一样。加上行中相应的LED灯被点亮,就能看到显示的字符了。三、源程序代码:R_CNTEQU31H;列码R_NCT=31H单元NUMBEQU32H;行码NUMB=32H单元TCOUNTEQU33H;拉幕计数值TCOUNT=33H单元ORG00H;程序起始地址LJMPSTARTORG0BH;中断入口地址LJMPINT_T0ORG30H;子程序入口地址S
4、TART:;主程序开始MOVR0,#00H;每列的行码起始序号置0MOVR_CNT,#00H;列:初值00送到31H单元MOVNUMB,#00H;行:初值00送到32H单元MOVTCOUNT,#00H;计数单元初值置0MOVTMOD,#01H;计数定时器选用16位的计数器,工作在方式1MOVTH0,#(65536-5000)/256;定时5ms。定时器高位初值为236MOVTL0,#(65536-5000)MOD256;定时器低位初值为120SETBTR0;启动C/T的定时器T0MOVIE,#82H;CPU开中断SJMP$;中断等待IN
5、T_T0:MOVTH0,#(65536-5000)/256;定时5ms,设置定时器T0高位初值为236MOVTL0,#(65536-5000)/256;定时器T0低位初值为120MOVDPTR,#TAB;读列码表首地址,放入DPTRMOVA,R_CNT;读列码偏移地址,放入A中MOVCA,@A+DPTR;基址变址寻址将寻到的列码数据放入A中MOVP3,A;将列码数据送P3口输出MOVDPTR,#NUB;装入显示数据的地址MOVA,NUMB;显示幕次的偏移地址MOVCA,@A+DPTR;寻到数据的行码地址MOVP0,A;将该地址值输出IN
6、CNUMB;行码地址加1NEXT1:INCR_CNT;扫描列码地址加1MOVA,R_CNT;把列地址放入A中CJNEA,#8,NEXT2;A不等于8,转子程序NEXT2,否则往下执行MOVR_CNT,#00H;就把列码置0MOVNUMB,R0;行码地址送存储单元格中NEXT2:INCTCOUNT;拉幕计数序号加1MOVA,TCOUNT;将幕次序号送A中CJNEA,#40,NEXT4;此序号不等于40转Next4,否则往下执行MOVTCOUNT,#00H;把拉幕时序归0INCR0;行码起始地址加1CJNER0,#88,NEXT3;行码自加
7、次数不满11字符×8行/字符=88行就转Next3MOVR0,#00H;不然就把行码置0NEXT3:MOVNUMB,R0;送新的一幕行码起始位给R0NEXT4:RETI;中断返回TAB:;列码码表DB0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,7FH;列扫描从右向左NUB:;行码码表,字符数据DB00H,00H,00H,00H,00H,00H,00H,00H;NULLDB00H,00H,3EH,41H,41H,41H,3EH,00H;0DB00H,00H,00H,00H,21H,7FH,01H,00H;1DB0
8、0H,00H,27H,45H,45H,45H,39H,00H;2DB00H,00H,22H,49H,49H,49H,36H,00H;3DB00H,00H,0CH,14H,24H,7FH,04H,00H;4D