如何用at89c51单片机8*8矩阵·显示英文字母how are you? 程序

2024-11-20 09:21:25
推荐回答(1个)
回答1:

我的程序是显示0-9的 你可以改一下 用字模软件把你要显示的字母转换一下代码即可。希望你成功!
TCOUNT EQU 30H
R_CNT EQU 31H
NUMB EQU 32H
ORG 00H
LJMP START
ORG 0BH
LJMP INT_T0
START: MOV TCOUNT,#00H
MOV R_CNT,#00H
MOV NUMB,#00H
MOV TMOD,#01H
MOV TH0,#(65536-4000)/256 ;定时4毫秒
MOV TL0,#(65536-4000) MOD 256
SETB TR0
MOV IE,#82H
SJMP $

INT_T0: MOV TH0,#(65536-4000)/256
MOV TL0,#(65536-4000) MOD 256
MOV DPTR,#TAB ;取列码
MOV A,R_CNT
MOVC A,@A+DPTR
MOV P3,A
MOV DPTR,#NUB ;取行码
MOV A,NUMB
MOV B,#8
MUL AB
ADD A,R_CNT
MOVC A,@A+DPTR
CPL A
MOV P0,A ;输出行码
INC R_CNT
MOV A,R_CNT
CJNE A,#8,NEXT
MOV R_CNT,#00H
NEXT: INC TCOUNT
MOV A,TCOUNT
CJNE A,#250,NEX ;每个数字显示1秒
MOV TCOUNT,#00H
INC NUMB
MOV A,NUMB
CJNE A,#10,NEX ;0到9循环显示
MOV NUMB,#00H
NEX: RETI
TAB: DB 0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,07FH
NUB: DB 00H,00H,3EH,41H,41H,41H,3EH,00H
DB 00H,00H,00H,00H,21H,7FH,01H,00H
DB 00H,00H,27H,45H,45H,45H,39H,00H
DB 00H,00H,22H,49H,49H,49H,36H,00H
DB 00H,00H,0CH,14H,24H,7FH,04H,00H
DB 00H,00H,72H,51H,51H,51H,4EH,00H
DB 00H,00H,3EH,49H,49H,49H,26H,00H
DB 00H,00H,40H,40H,40H,4FH,70H,00H
DB 00H,00H,36H,49H,49H,49H,36H,00H
DB 00H,00H,32H,49H,49H,49H,3EH,00H
END