给你一个源代码吧,自己分析,用汇编写的。本人编写后亲试过,只要一片C8052S的最少系统就能工作 驱动市售$5.0单元板(32*64)。
;============================================
; 32*64点阵屏左滚动显示n个汉字程序
;============================================
D_FR0 EQU 40H ;第一个显示数据缓冲器
D_FR1 EQU 70H
D_MB EQU 30H ;数据位移动次数寄存器
D_AM EQU 31H ;显示半角字个数寄存器
DAMT EQU 32H ;显示半角字个数倍数寄存器
OFFSET EQU 33H ;数据指针偏移量
RED0 BIT P1.4
RED1 BIT P3.1
RCK BIT P1.5 ;锁存信号线
SCK BIT P1.6 ;移位时钟信号线
EN BIT P1.7 ;消隐信号线
;--------程序入口地址----------------
ORG 0000H
JMP START
ORG 0030H
;====================================
; 初始化
;====================================
START:
CLR A
MOV 60H,A
MOV 61H,A
MOV 62H,A
MOV 63H,A
MOV SP, #0AH ;修改堆栈指针
MOV R7, #5
MOV R0,#D_FR0
MOV R1,#D_FR1
ST1:MOV @R0,A
MOV @R1,A
INC R0
INC R1
DJNZ R7, ST1 ;40H-44H
MOV R7, #20H
MOV R0, #D_MB
ST2:MOV @R0, A
INC R0
DJNZ R7, ST2 ;寄存器清0 ,
MOV P1, #0ffH
MOV DPTR,#TABLE1
MOV 62H,DPL
MOV 63H,DPH
MOV DPTR,#TABLE2
MOV 64H,DPL
MOV 65H,DPH
MOV DAMT,#1;显示的半角字的个数的倍数
MOV R4, #2
;====================================
; 主程序
;====================================
MAIN:
MOV R5, #16 ;扫描16行
MOV OFFSET, #00H ;数据指针偏移量清0
MA1:CALL QUSHU ;调用取数子程序
CALL DSEND ;调用发送子程序
clr EN ;关显示
inc P1 ;修改行值
CLR RCK
SETB RCK ;锁存显示数据
setb EN ;开显示
DJNZ R5, MA1 ;16行未完继续
DJNZ R4, MAIN
MOV R4,#5 ;移动速度
INC D_MB
MOV A,D_MB
CJNE A, #8,M_OUT
MOV D_MB, #0 ;1个半角字符要移动8次
MOV A,#16
MOV DPL,62H
MOV DPH,63H
ADD A,DPL
MOV DPL,A
MOV 62H,DPL
MOV A,DPH
ADDC A,#00H
MOV DPH,A
MOV 63H,DPH
MOV A,#16
MOV DPL,64H
MOV DPH,65H
ADD A,DPL
MOV DPL,A
MOV 64H,DPL
MOV A,DPH
ADDC A,#00H
MOV DPH,A
MOV 65H,DPH
INC D_AM
MOV A,D_AM
CJNE A, #30,M_OUT ;显示的半角字符的个数
MOV D_AM, #00H
DJNZ DAMT, M_OUT
MOV DAMT, #1 ;显示的半角字的个数的倍数
MOV DPTR,#TABLE1
MOV 62H,DPL
MOV 63H,DPH
MOV DPTR,#TABLE2
MOV 64H,DPL
MOV 65H,DPH
MOV P1,#0ffH
M_OUT: JMP MAIN
;===================================
; 取一行数子程序
;===================================
QUSHU:
MOV R7,#9
MOV R0,#D_FR0
MOV DPL,62H
MOV DPH,63H
PUSH DPL
PUSH DPH
MOV A,OFFSET
QUSHU1:
ADD A,DPL
MOV DPL,A
MOV A,DPH
ADDC A,#00H
MOV DPH,A
CLR A
MOVC A,@A+DPTR
MOV @R0,A
INC R0
MOV A,#16
DJNZ R7,QUSHU1
POP DPH
POP DPL
MOV 62H,DPL
MOV 63H,DPH
QUSHU2:
MOV R7,#9
MOV R0,#D_FR1
MOV DPL,64H
MOV DPH,65H
PUSH DPL
PUSH DPH
MOV A,OFFSET
QUSHU3:
ADD A,DPL
MOV DPL,A
MOV A,DPH
ADDC A,#00H
MOV DPH,A
CLR A
MOVC A,@A+DPTR
MOV @R0,A
INC R0
MOV A,#16
DJNZ R7,QUSHU3
POP DPH
POP DPL
MOV 65H,DPH
MOV 64H,DPL
INC OFFSET
RET
;===================================
; 数据发送子程序
;===================================
DSEND:
MOV R0,#D_FR0 ;第一个显示数据缓冲区地址放人R0
MOV R1,#D_FR1
MOV R6,#8 ;发送n字节(1行)
DSE1:MOV R7,#8 ;每次发送8位
MOV 60H,@R0
MOV 61H,@R1 ;显示数据放入A
CPL 60H
cpl 61H;取反A
DSE2: MOV A,60H
RLC A ;将A的内容按位移入C
MOV RED0,C ;将C的内容送数据总线
MOV 60H,A
MOV A,61H
RLC A
MOV RED1,C
MOV 61H,A
CLR SCK
SETB SCK ;输出移位脉冲
DJNZ R7, DSE2
INC R0
INC R1 ;修改地址指针
DJNZ R6, DSE1
;--------屏幕左移一位---------------
MOV A,D_MB ;移动位次数放入A
JZ TAMEND ;为0转移
MOV R7,D_MB ;移动位次数放入R7
MOV 60H,@R0
MOV 61H,@R1
cpl 60H ;移入的数据存入A
CPL 61H
DSE3:MOV A,60H
RLC A ;将A的内容按位移入C
MOV RED0,C ;将C的内容送数据总线
MOV 60H,A
MOV A,61H
RLC A
MOV RED1,C
MOV 61H,A
CLR SCK
SETB SCK ;输出移位脉冲
DJNZ R7, DSE3 ;移位次数未完继续
;--------移位时间修正---------------
TAMEND: CLR C ;清C
MOV A, #100
SUBB A,D_MB ;需要再延时的次数
JZ D_OUT
MOV R7, A
TA1: NOP
NOP
NOP
NOP
DJNZ R7, TA1 ;空操作(延时)
D_OUT: RET
;====================================
; 文字编码表
;====================================
TABLE1:
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H,00H,0FCH,04H,45H,46H,28H,28H,10H,28H,24H,44H,81H,01H,02H,0CH
DB 80H,80H,80H,0FCH,04H,48H,40H,40H,40H,40H,0A0H,0A0H,10H,08H,0EH,04H
DB 00H,41H,26H,14H,04H,04H,0F4H,14H,15H,16H,14H,10H,10H,28H,47H,00H
DB 00H,84H,7EH,44H,44H,44H,44H,0C4H,44H,54H,48H,40H,40H,46H,0FCH,00H
DB 01H,21H,11H,09H,09H,01H,0FFH,04H,04H,04H,04H,08H,08H,10H,20H,40H
DB 00H,08H,0CH,10H,20H,04H,0FEH,40H,40H,40H,40H,40H,42H,42H,3EH,00H
DB 10H,10H,51H,51H,52H,54H,58H,50H,57H,54H,54H,54H,54H,14H,17H,14H
DB 80H,80H,04H,0FEH,00H,80H,60H,24H,0FEH,44H,44H,44H,44H,44H,0FCH,04H
DB 00H,01H,03H,03H,03H,03H,03H,01H,01H,01H,00H,01H,03H,01H,00H,00H
DB 00H,80H,0C0H,0C0H,0C0H,0C0H,0C0H,80H,80H,80H,00H,80H,0C0H,80H,00H,00H
DB 00H,40H,30H,17H,00H,02H,0F1H,10H,10H,10H,10H,11H,12H,28H,47H,00H
DB 80H,40H,48H,0FCH,10H,10H,20H,0A0H,40H,40H,0A0H,10H,10H,06H,0FCH,00H
DB 00H,3FH,21H,21H,3FH,21H,21H,21H,3FH,01H,01H,7FH,01H,01H,0FFH,00H
DB 08H,0FCH,08H,08H,0F8H,08H,08H,08H,0F8H,00H,08H,0FCH,00H,04H,0FEH,00H
DB 0FH,08H,08H,0FH,08H,08H,0FH,00H,0FFH,01H,09H,09H,09H,15H,23H,40H
DB 0E0H,20H,20H,0E0H,20H,20H,0E0H,04H,0FEH,00H,20H,0F0H,00H,00H,06H,0FCH
DB 42H,32H,12H,02H,9FH,62H,22H,0FH,18H,28H,0C8H,48H,48H,4FH,48H,40H
DB 04H,3EH,24H,24H,0E4H,3CH,0A4H,0E4H,0A4H,0BCH,0A4H,0A4H,0A4H,0A4H,54H,88H
DB 04H,04H,04H,04H,04H,7CH,04H,04H,04H,04H,04H,04H,1CH,0E4H,44H,00H
DB 80H,80H,88H,98H,0A0H,0C0H,80H,80H,80H,80H,80H,80H,82H,82H,7EH,00H
DB 01H,09H,09H,11H,11H,20H,03H,0CH,3FH,0C8H,0FH,08H,0FH,08H,0FH,08H
DB 00H,20H,10H,0CH,24H,0C0H,00H,08H,0FCH,08H,0F8H,08H,0F8H,08H,0F8H,08H
DB 01H,01H,7FH,41H,81H,02H,02H,05H,09H,18H,28H,48H,88H,0AH,0CH,08H
DB 00H,00H,0FEH,02H,04H,00H,08H,18H,20H,0C0H,80H,40H,30H,0EH,04H,00H
DB 04H,04H,04H,04H,44H,24H,24H,14H,14H,14H,14H,04H,04H,04H,0FFH,00H
DB 40H,40H,40H,40H,44H,44H,48H,48H,50H,50H,60H,40H,40H,44H,0FEH,00H
DB 04H,0EH,0F8H,08H,08H,0FEH,08H,1CH,1AH,29H,28H,48H,88H,08H,08H,08H
DB 10H,10H,90H,50H,10H,90H,50H,14H,1EH,0F0H,10H,10H,10H,10H,10H,10H
DB 22H,11H,11H,00H,7FH,40H,80H,1FH,00H,01H,0FFH,01H,01H,01H,05H,02H
DB 08H,08H,10H,20H,0FEH,02H,04H,0E0H,40H,84H,0FEH,00H,00H,00H,00H,00H
DB 00H,78H,4FH,54H,58H,63H,50H,48H,4FH,48H,68H,50H,41H,41H,42H,4CH
DB 80H,40H,0FEH,02H,14H,0F8H,00H,08H,0FCH,0A0H,0A0H,0A0H,22H,22H,1EH,00H
DB 06H,0F8H,11H,11H,0FFH,39H,55H,91H,11H,0FEH,24H,44H,28H,11H,2AH,44H
DB 40H,84H,0FEH,24H,24H,0FCH,24H,44H,0FCH,40H,60H,0A0H,0A8H,22H,22H,1EH
DB 01H,01H,01H,0FFH,01H,01H,01H,3FH,00H,02H,11H,50H,50H,90H,0FH,00H
DB 00H,00H,04H,0FEH,00H,00H,10H,0F8H,00H,00H,80H,84H,12H,12H,0F0H,00H
DB 82H,44H,29H,0FEH,10H,11H,7CH,10H,10H,0FEH,11H,12H,10H,20H,21H,40H
DB 00H,04H,0DEH,44H,44H,54H,0CCH,44H,44H,0CCH,54H,64H,44H,44H,54H,88H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,30H,1EH,0FH,07H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 01H,01H,7FH,01H,05H,09H,31H,0C1H,0FH,00H,01H,7FH,01H,01H,05H,02H
DB 00H,08H,0FCH,00H,40H,30H,0EH,04H,0E0H,40H,88H,0FCH,00H,00H,00H,00H
DB 08H,08H,08H,08H,0FEH,08H,18H,1CH,2AH,28H,49H,8AH,08H,08H,08H,08H
DB 20H,20H,20H,24H,0FEH,20H,60H,70H,0A8H,0AEH,24H,20H,20H,20H,20H,20H
DB 00H,7FH,40H,40H,5FH,40H,40H,4FH,48H,48H,48H,48H,4FH,48H,40H,40H
DB 04H,0FEH,04H,24H,0F4H,04H,24H,0F4H,24H,24H,24H,24H,0E4H,24H,14H,08H
DB 22H,11H,11H,00H,7FH,40H,80H,1FH,00H,01H,0FFH,01H,01H,01H,05H,02H
DB 08H,08H,10H,20H,0FEH,02H,04H,0E0H,40H,84H,0FEH,00H,00H,00H,00H,00H
DB 10H,10H,22H,7FH,42H,43H,42H,42H,7EH,42H,42H,42H,42H,7EH,42H,00H
DB 40H,40H,44H,7EH,84H,04H,04H,84H,64H,24H,04H,04H,04H,04H,28H,10H
DB 08H,08H,08H,17H,10H,30H,50H,90H,17H,10H,10H,10H,10H,10H,1FH,10H
DB 80H,40H,44H,0FEH,40H,40H,40H,48H,0FCH,40H,40H,40H,40H,44H,0FEH,00H
DB 02H,07H,38H,20H,20H,3EH,22H,22H,22H,3EH,22H,20H,21H,42H,84H,00H
DB 08H,1CH,0E0H,80H,80H,84H,0FEH,88H,88H,88H,88H,88H,08H,08H,08H,08H
DB 00H,01H,03H,03H,03H,03H,03H,01H,01H,01H,00H,01H,03H,01H,00H,00H
DB 00H,80H,0C0H,0C0H,0C0H,0C0H,0C0H,80H,80H,80H,00H,80H,0C0H,80H,00H,00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
TABLE2:
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 01H,01H,02H,04H,08H,12H,21H,0C0H,00H,1FH,00H,00H,00H,00H,00H,01H
db 00H,00H,80H,40H,20H,10H,8EH,84H,00H,0F0H,10H,20H,20H,40H,80H,00H
DB 00H,7FH,01H,01H,01H,01H,0FFH,01H,02H,02H,04H,04H,08H,10H,20H,0C0H
db 08H,0FCH,00H,00H,00H,04H,0FEH,00H,80H,80H,40H,40H,20H,10H,0EH,04H
DB 00H,08H,7DH,4AH,4CH,4BH,4AH,7AH,4AH,4BH,4AH,48H,78H,49H,02H,04H
db 80H,80H,0F8H,10H,24H,0FEH,44H,44H,44H,0FCH,64H,0A0H,0A2H,22H,1EH,00H
DB 01H,01H,01H,01H,01H,01H,01H,01H,01H,01H,01H,01H,01H,01H,0FFH,00H
db 00H,00H,00H,00H,10H,0F8H,00H,00H,00H,00H,00H,00H,00H,04H,0FEH,00H
DB 02H,02H,0FFH,04H,04H,0FH,08H,18H,2FH,48H,88H,0FH,08H,08H,08H,08H
db 00H,04H,0FEH,00H,10H,0F8H,10H,10H,0F0H,10H,10H,0F0H,10H,10H,50H,20H
DB 01H,01H,01H,01H,01H,7DH,05H,05H,09H,09H,11H,21H,41H,81H,05H,02H
db 00H,00H,00H,08H,18H,20H,0C0H,80H,40H,20H,10H,0EH,04H,00H,00H,00H
DB 00H,7CH,44H,49H,48H,50H,48H,4BH,44H,45H,45H,69H,51H,41H,41H,41H
db 20H,20H,28H,0FCH,20H,20H,24H,0FEH,20H,24H,24H,24H,24H,24H,0FCH,04H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,60H,20H,20H,40H
DB 08H,0BH,12H,12H,23H,4AH,8AH,13H,32H,52H,92H,12H,12H,12H,13H,12H
db 08H,0FCH,08H,08H,0F8H,08H,08H,0F8H,84H,8CH,50H,20H,10H,88H,0EH,04H
DB 00H,1FH,10H,10H,1FH,10H,10H,1FH,14H,44H,34H,14H,04H,04H,0FFH,00H
db 10H,0F8H,10H,10H,0F0H,10H,10H,0F0H,50H,44H,4CH,50H,40H,44H,0FEH,00H
DB 10H,10H,10H,1EH,22H,33H,4AH,0A4H,14H,08H,11H,22H,40H,24H,24H,40H
db 20H,20H,28H,24H,20H,0FEH,20H,50H,50H,88H,0EH,04H,00H,48H,46H,02H
DB 04H,0EH,78H,08H,08H,0FFH,08H,08H,0AH,0CH,18H,68H,09H,0AH,28H,10H
db 80H,0A0H,90H,90H,84H,0FEH,80H,90H,90H,60H,40H,0A0H,20H,14H,14H,0CH
DB 10H,12H,11H,24H,24H,64H,0A4H,24H,24H,24H,24H,24H,24H,24H,24H,24H
db 00H,04H,7EH,84H,04H,04H,04H,04H,04H,04H,04H,04H,04H,04H,14H,08H
DB 00H,7FH,10H,10H,10H,08H,08H,04H,04H,02H,01H,02H,04H,08H,30H,0C0H
db 00H,0F0H,10H,10H,20H,20H,40H,40H,80H,80H,00H,80H,40H,30H,0EH,04H
DB 10H,10H,10H,13H,0FCH,10H,14H,18H,30H,0D0H,10H,10H,10H,10H,50H,20H
db 00H,00H,04H,0FEH,20H,20H,20H,20H,20H,20H,20H,20H,20H,20H,0A0H,40H
DB 00H,0FFH,00H,00H,01H,01H,03H,05H,09H,11H,21H,41H,01H,01H,01H,01H
db 04H,0FEH,80H,80H,00H,00H,40H,20H,18H,0CH,04H,00H,00H,00H,00H,00H
DB 00H,40H,20H,17H,00H,00H,0F1H,10H,10H,10H,10H,10H,10H,28H,47H,00H
db 10H,10H,10H,0FCH,10H,10H,10H,90H,90H,10H,10H,50H,20H,06H,0FCH,00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
END
温馨提示:内容为网友见解,仅供参考