求助谁帮我用单片机控制的16x16点阵LED循环显示“08自动化毕业设计张少鹏”,这个程序怎么写嘛?
谁能帮我用单片机控制的16x16点阵LED循环显示“08自动化毕业设计张少鹏”,这个程序怎么写嘛?我只要程序放在论文里是静止的一个字一个字的循环显示~...
谁能帮我用单片机控制的16x16点阵LED循环显示“08自动化毕业设计张少鹏”,这个程序怎么写嘛?我只要程序放在论文里 是静止的一个字一个字的循环显示~
展开
2个回答
展开全部
ORG 0000H
A1 EQU 20H ;用A1代替直接寻址单元20H
A2 EQU 21H
A3 EQU 22H
A4 EQU 23H
A5 EQU 24H ;代表字的码表
A6 EQU 25H ;代表要显示字的个数
START: MOV P1,#00H ;初始化
MOV P0,#00H
MOV P2,#00H
MOV A1,#00H
MOV A2,#00H
MOV A3,#00H
MOV A4,#00H
MOV A5,#00H
MOV A6,#00H
MOV A1,#0FFH
MOV A2,#00H
MOV R4,#01H ;为遁环次数
START1: MOV P0,A1 ;此子程序为测试程序,测试模块有没有坏点
MOV P2,A1
MOV P1,A2
LCALL DELAY125
MOV A,A1
RL A
MOV A1,A
INC A2
MOV A,A2
CJNE A,#10H,START1 ;跑完16列后执行至显示中文文字程序!
MOV A2,#00H
START3: MOV A1,#00H ;初始化条件
MOV A3,#00H
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV A6,#1
MOV A5,#0
ACALL DELAY1S ;1S不秒显示!
ZHONG1: MOV R3,#02H ;R3与R4为显示字的时间的参数,越大则显示的字越久!=R3*R4
ZY6: MOV R4,#3FH
ZY2: AJMP TJ1 ;跳至选字的码程序!
MAIN1: NOP ;空操作
MAIN2: MOV A,A3
MOVC A,@A+DPTR ;读取程序中字的码,上半部分!
MOV P0,A
INC A3
MOV A,A3
MOVC A,@A+DPTR ;读取程序中字的码,下半部分!
MOV P2,A
MOV P1,A1
LCALL DELAY5 ;延时5MS后再返回取下一个字的码!
INC A3
INC A1
MOV A,A1
CJNE A,#0FH,MAIN2
MOV A1,#0
MOV A3,#0
DJNZ R4,ZY2
DJNZ R3,ZY6
INC A5
INC A6
LCALL DELAY125
MOV A,A6
CJNE A,#8,ZHONG1 ;一共显示6个字后马上返回(7-1=6)
LCALL DELAY1S ;显示完后延时1S
AJMP START3 ;无条件跳转至开始条件,从新开始
TJ1: MOV A,A6 ;显示第一个字,则A6等于1,第二个字A6等于2,如此类推!
CJNE A,#1,TJ2
MOV DPTR,#TAB1
ZY1: MOV A,A5 ;附加程序,主要用来程序扩展!比如说四个LED的程序!
MOV B,#2
DIV AB
MOV A,B
CJNE A,#0,MAIN1
AJMP MAIN1
TJ2: CJNE A,#2,TJ3
MOV DPTR,#TAB2
AJMP ZY1
TJ3: CJNE A,#3,TJ4
MOV DPTR,#TAB3
AJMP ZY1
TJ4: CJNE A,#4,TJ5
MOV DPTR,#TAB4
AJMP ZY1
TJ5: CJNE A,#5,TJ6
MOV DPTR,#TAB5
AJMP ZY1
TJ6: CJNE A,#6,TJ7
MOV DPTR,#TAB6
AJMP ZY1
TJ7: CJNE A,#6,TJ8
MOV DPTR,#TAB7
AJMP ZY1
TJ8: AJMP START3 ;程序跳转返回
DELAY125: MOV R7,#0FFH ;125MS延时,用显示字的间隔
D1: MOV R6,#0FFH
DJNZ R6,$
DJNZ R7,D1
RET
DELAY1S: MOV R7,#08H ;1S延时
D2: MOV R6,#0FFH
D3: MOV R5,#0FFH
DJNZ R5,$
DJNZ R6,D3
DJNZ R7,D2
RET
DELAY5: MOV R7,#2 ;5MS延时,用于列扫描的时间
D4: MOV R6,#09FH
DJNZ R6,$
DJNZ R7,D4
RET
TAB1: DB 02H,00H,04H,00H,1FH,0FFH,0E0H,00H ;你
DB 02H,00H,04H,10H,18H,20H,0F0H,0C2H
DB 10H,01H,13H,0FEH,10H,00H,10H,80H
DB 14H,60H,18H,30H,00H,00H,00H,00H
TAB2: DB 08H,02H,08H,44H,0FH,0A8H,0F8H,10H ;好
DB 08H,28H,0FH,0C6H,01H,00H,41H,00H
DB 41H,02H,41H,01H,47H,0FEH,49H,00H
DB 51H,00H,63H,00H,01H,00H,00H,00H
TAB3: DB 20H,08H,2CH,10H,23H,60H,20H,80H ;欢
DB 23H,41H,3CH,31H,04H,02H,08H,0CH
DB 0F0H,30H,17H,0C0H,10H,30H,10H,08H
DB 14H,06H,18H,03H,00H,02H,00H,00H
TAB4: DB 02H,00H,42H,02H,22H,04H,13H,0F8H ;迎
DB 00H,04H,3FH,0E2H,20H,42H,40H,82H
DB 41H,02H,3FH,0FEH,20H,02H,20H,42H
DB 20H,22H,7FH,0C6H,20H,04H,00H,00H
TAB5: DB 02H,00H,02H,01H,42H,02H,22H,04H ;光
DB 1AH,18H,03H,0E0H,02H,00H,0FEH,00H
DB 02H,00H,03H,0FCH,0AH,02H,12H,02H
DB 62H,02H,26H,02H,02H,0EH,00H,00H
TAB6: DB 00H,00H,3FH,0F8H,00H,00H,0FFH,0FFH ;临
DB 02H,00H,04H,0FFH,08H,82H,30H,82H
DB 0D4H,82H,12H,0FEH,13H,82H,10H,82H
DB 10H,82H,31H,0FFH,10H,80H,00H,00H
TAB7: DB 00H,00H,00H,00H,00H,00H,00H,00H ;空的字
DB 00H,00H,00H,00H,00H,0H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H
END
~~~~~51的程序,里面的字码,你根据需要修改即可。
A1 EQU 20H ;用A1代替直接寻址单元20H
A2 EQU 21H
A3 EQU 22H
A4 EQU 23H
A5 EQU 24H ;代表字的码表
A6 EQU 25H ;代表要显示字的个数
START: MOV P1,#00H ;初始化
MOV P0,#00H
MOV P2,#00H
MOV A1,#00H
MOV A2,#00H
MOV A3,#00H
MOV A4,#00H
MOV A5,#00H
MOV A6,#00H
MOV A1,#0FFH
MOV A2,#00H
MOV R4,#01H ;为遁环次数
START1: MOV P0,A1 ;此子程序为测试程序,测试模块有没有坏点
MOV P2,A1
MOV P1,A2
LCALL DELAY125
MOV A,A1
RL A
MOV A1,A
INC A2
MOV A,A2
CJNE A,#10H,START1 ;跑完16列后执行至显示中文文字程序!
MOV A2,#00H
START3: MOV A1,#00H ;初始化条件
MOV A3,#00H
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV A6,#1
MOV A5,#0
ACALL DELAY1S ;1S不秒显示!
ZHONG1: MOV R3,#02H ;R3与R4为显示字的时间的参数,越大则显示的字越久!=R3*R4
ZY6: MOV R4,#3FH
ZY2: AJMP TJ1 ;跳至选字的码程序!
MAIN1: NOP ;空操作
MAIN2: MOV A,A3
MOVC A,@A+DPTR ;读取程序中字的码,上半部分!
MOV P0,A
INC A3
MOV A,A3
MOVC A,@A+DPTR ;读取程序中字的码,下半部分!
MOV P2,A
MOV P1,A1
LCALL DELAY5 ;延时5MS后再返回取下一个字的码!
INC A3
INC A1
MOV A,A1
CJNE A,#0FH,MAIN2
MOV A1,#0
MOV A3,#0
DJNZ R4,ZY2
DJNZ R3,ZY6
INC A5
INC A6
LCALL DELAY125
MOV A,A6
CJNE A,#8,ZHONG1 ;一共显示6个字后马上返回(7-1=6)
LCALL DELAY1S ;显示完后延时1S
AJMP START3 ;无条件跳转至开始条件,从新开始
TJ1: MOV A,A6 ;显示第一个字,则A6等于1,第二个字A6等于2,如此类推!
CJNE A,#1,TJ2
MOV DPTR,#TAB1
ZY1: MOV A,A5 ;附加程序,主要用来程序扩展!比如说四个LED的程序!
MOV B,#2
DIV AB
MOV A,B
CJNE A,#0,MAIN1
AJMP MAIN1
TJ2: CJNE A,#2,TJ3
MOV DPTR,#TAB2
AJMP ZY1
TJ3: CJNE A,#3,TJ4
MOV DPTR,#TAB3
AJMP ZY1
TJ4: CJNE A,#4,TJ5
MOV DPTR,#TAB4
AJMP ZY1
TJ5: CJNE A,#5,TJ6
MOV DPTR,#TAB5
AJMP ZY1
TJ6: CJNE A,#6,TJ7
MOV DPTR,#TAB6
AJMP ZY1
TJ7: CJNE A,#6,TJ8
MOV DPTR,#TAB7
AJMP ZY1
TJ8: AJMP START3 ;程序跳转返回
DELAY125: MOV R7,#0FFH ;125MS延时,用显示字的间隔
D1: MOV R6,#0FFH
DJNZ R6,$
DJNZ R7,D1
RET
DELAY1S: MOV R7,#08H ;1S延时
D2: MOV R6,#0FFH
D3: MOV R5,#0FFH
DJNZ R5,$
DJNZ R6,D3
DJNZ R7,D2
RET
DELAY5: MOV R7,#2 ;5MS延时,用于列扫描的时间
D4: MOV R6,#09FH
DJNZ R6,$
DJNZ R7,D4
RET
TAB1: DB 02H,00H,04H,00H,1FH,0FFH,0E0H,00H ;你
DB 02H,00H,04H,10H,18H,20H,0F0H,0C2H
DB 10H,01H,13H,0FEH,10H,00H,10H,80H
DB 14H,60H,18H,30H,00H,00H,00H,00H
TAB2: DB 08H,02H,08H,44H,0FH,0A8H,0F8H,10H ;好
DB 08H,28H,0FH,0C6H,01H,00H,41H,00H
DB 41H,02H,41H,01H,47H,0FEH,49H,00H
DB 51H,00H,63H,00H,01H,00H,00H,00H
TAB3: DB 20H,08H,2CH,10H,23H,60H,20H,80H ;欢
DB 23H,41H,3CH,31H,04H,02H,08H,0CH
DB 0F0H,30H,17H,0C0H,10H,30H,10H,08H
DB 14H,06H,18H,03H,00H,02H,00H,00H
TAB4: DB 02H,00H,42H,02H,22H,04H,13H,0F8H ;迎
DB 00H,04H,3FH,0E2H,20H,42H,40H,82H
DB 41H,02H,3FH,0FEH,20H,02H,20H,42H
DB 20H,22H,7FH,0C6H,20H,04H,00H,00H
TAB5: DB 02H,00H,02H,01H,42H,02H,22H,04H ;光
DB 1AH,18H,03H,0E0H,02H,00H,0FEH,00H
DB 02H,00H,03H,0FCH,0AH,02H,12H,02H
DB 62H,02H,26H,02H,02H,0EH,00H,00H
TAB6: DB 00H,00H,3FH,0F8H,00H,00H,0FFH,0FFH ;临
DB 02H,00H,04H,0FFH,08H,82H,30H,82H
DB 0D4H,82H,12H,0FEH,13H,82H,10H,82H
DB 10H,82H,31H,0FFH,10H,80H,00H,00H
TAB7: DB 00H,00H,00H,00H,00H,00H,00H,00H ;空的字
DB 00H,00H,00H,00H,00H,0H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H
END
~~~~~51的程序,里面的字码,你根据需要修改即可。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询