//8*8点阵LED显示,用单片机AT89C51 驱动8*8点阵LED显示屏
//轮流显示0-9的数字,显示的方式采用自右向左拉幕式显示
//源程序和proteus仿真我一打包,地址:http://proteus.5d6d.com/thread-9031-1-1.html
R_CNT EQU 31H
NUMB EQU 32H
TCOUNT EQU 33H
ORG 0000H
LJMP START
ORG 0BH ;定时器中断入口地址
LJMP INT_T0
ORG 0030H
START: MOV R0,#00H ;显示的幕次(即每一幕显示的:行码起始序号)值0
MOV R_CNT,#00H ;列码序列号置0
MOV TCOUNT,#00H ;行码序列号置0
MOV TMOD,#01H
MOV TH0,#(65536-5000)/256
MOV TL0,#(65536-5000)MOD 256
SETB TR0
MOV IE,#82H
SJMP $
//定时器中断处理函数
INT_T0: MOV TH0,#(65536-5000)/256
MOV TL0,#(65536-5000)MOD 256
MOV DPTR,#TAB ;取列码表 首地址
MOV A,R_CNT
MOVC A,@A+DPTR
MOV P3,A
MOV DPTR,#NUB ;取行码表 首地址
MOV A,NUMB
MOVC A,@A+DPTR
MOV P0,A ;输出行号
INC NUMB
NEXT1: INC R_CNT
MOV A,R_CNT
CJNE A,#8,NEXT2
MOV R_CNT,#0
MOV NUMB,R0
NEXT2: INC TCOUNT
MOV A,TCOUNT
CJNE A,#40,NEXT4 ;每个数字显示200ms
MOV TCOUNT,#00H
INC R0 ;上一幕显示行码的起始序列号+1
CJNE R0,#88,NEXT3
MOV R0,#00H
NEXT3: MOV NUMB,R0 ;送新一幕显示行码的起始序列号
NEXT4: RETI
TAB: DB 0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,7FH ;列值
NUB: DB 00H,00H,00H,00H,00H,00H,00H,00H ;空
DB 00H,00H,3EH,41H,41H,41H,3EH,00H ;0
DB 00H,00H,00H,00H,21H,7FH,01H,00H ;1
DB 00H,00H,27H,45H,45H,45H,39H,00H ;2
DB 00H,00H,22H,49H,49H,49H,36H,00H ;3
DB 00H,00H,0CH,14H,24H,7FH,04H,00H ;4
DB 00H,00H,72H,51H,51H,51H,4EH,00H ;5
DB 00H,00H,3EH,49H,49H,49H,26H,00H ;6
DB 00H,00H,40H,40H,40H,4FH,70H,00H ;7
DB 00H,00H,36H,49H,49H,49H,36H,00H ;8
DB 00H,00H,32H,49H,49H,49H,3EH,00H ;9
DB 00H,00H,00H,00H,00H,00H,00H,00H ;空
END
上一篇:独立键盘实现计数功能程序(汇编)
下一篇:74ls595在proteus中的使用和浅谈
推荐阅读最新更新时间:2024-03-16 15:09