前阵子我在别的
论坛买了一块16×64的点阵屏,带STC89C52RC驱动的,根据实物,我已绘制出其电路,并
下载了一个左移
程序,但搞了很久,都无法解决重影问题!如果一帧只扫一次的话,没有重影,每行扫频为1ms,但移动速度很多,没什么实用价值,于是设置R2延迟因子,同一帧扫几次,这样左移速度虽然慢下来了,但有重影。请高人指导一二!谢谢!!
电路及汇
编程序如下:
;============================================
; 16*64点阵屏左移程序
;============================================
D_F EQU 40H ;第一个显示数据缓冲器
D_MB EQU 30H ;数据位移动次数寄存器
D_AM EQU 31H ;显示半角字个数寄存器
DAMT EQU 32H ;显示半角字个数倍数寄存器
OFFSET EQU 33H ;数据指针偏移量
EN EQU P2.7 ;消隐信号线
S_I EQU P3.5 ;数据总线
RCK EQU P2.6 ;锁存信号线
SCK EQU P2.5 ;移位时钟信号线
;--------程序入口地址----------------
ORG 0000H
JMP START
ORG 0030H
;====================================
; 初始化
;====================================
START:
MOV SP, #0AH ;修改堆栈指针
CLR A ;清累加器
MOV R7, #9
MOV R0, #D_F
ST1: MOV @R0, A
INC R0
DJNZ R7, ST1
MOV R7, #4
MOV R0, #D_MB
ST2: MOV @R0, A
INC R0
DJNZ R7, ST2 ;寄存器清0
MOV P2, #0FFH
MOV DPTR, #DTAB ;数据表首地址放入DPTR
MOV DAMT, #1 ;显示的半角字的个数的倍数
MOV R2, #4
;====================================
; 主程序
;====================================
MAIN:
MOV R5, #16 ;扫描16行
MOV OFFSET, #00H ;数据指针偏移量清0
MA1: CALL QUSHU ;调用取数子程序
CALL DSEND ;调用发送子程序
SETB EN ;关显示
CLR RCK
NOP
SETB RCK ;锁存显示数据
PUSH DPH
PUSH DPL ;数据保护
MOV DPTR, #TAB ;定位行选表
MOV A, R5
DEC A ;修正行选位
MOVC A, @A+DPTR ;提取行选码
ANL P2, #0F0H ;将P2低四位清零
ADD A, P2 ;A的低四位行选码和P2的高四位相加
MOV P2, A ;将结果放回P2
POP DPL
POP DPH
CLR EN ;开显示
LCALL DELAY
DJNZ R5, MA1 ;16行未完继续
DJNZ R2, MAIN
MOV R2, #4;移动速度
INC D_MB
MOV A, D_MB
CJNE A, #8,MAIN
MOV D_MB, #0 ;1个半角字符要移动8次
MOV A, #16
ADD A, DPL
MOV DPL, A
MOV A, DPH
ADDC A, #00H
MOV DPH, A ;地址指针修改
INC D_AM
MOV A, D_AM
CJNE A, #64, MAIN ;显示的半角字符的个数
MOV D_AM, #00H
DJNZ DAMT, MAIN
;MOV DAMT, #1 ;显示的半角字的个数的倍数
JMP START ;循环滚动显示
;===================================
; 取一行数子程序
;===================================
QUSHU:
MOV R7, #9 ;取出半角字数据的个数
MOV R0, #D_F ;数据缓冲区首地址存入R0
PUSH DPH
PUSH DPL ;数据保护
MOV A, OFFSET ;查表偏移量放入A
QUSH1: 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, QUSH1 ;数据未取完继续
POP DPL
POP DPH
INC OFFSET ;查表偏移量+1
RET
;===================================
; 数据发送子程序
;===================================
DSEND:
MOV R0, #D_F ;第一个显示数据缓冲区地址放入R0
MOV R6, #8 ;发送N字节(1行)
DSE1: MOV R7, #8 ;每次发送8位
MOV A, @R0 ;显示数据放入A
;CPL A ;取反A
DSE2: RLC A ;将A的内容按位移入C
MOV S_I, C ;将C的内容送数据总线
CLR SCK
NOP
SETB SCK ;输出移位脉冲
DJNZ R7, DSE2 ;8位未发送完继续
INC R0 ;修改地址指针
DJNZ R6, DSE1 ;字节数未发送完继续
;--------屏幕左移一位---------------
MOV A, D_MB ;移动位次数放入A
JZ TAMEND ;为0转移
MOV R7, D_MB ;移动位次数放入R7
MOV A, @R0 ;移入的数据存入A
;CPL A ;取反A
DSE3: RLC A ;将A的内容按位移入C
MOV S_I, C ;将C的内容送数据总线
CLR SCK
NOP
SETB SCK ;输出移位脉冲
DJNZ R7, DSE3 ;移位次数未完继续
;--------移位时间修正---------------
TAMEND: CLR C ;清C
MOV A, #7
SUBB A, D_MB ;需要再延时的次数
JZ D_OUT
MOV R7, A
TA1:
DJNZ R7, TA1 ;空操作(延时)
D_OUT: RET
;****************************************
DELAY:
MOV R4,#5
D1:MOV R3,#25
DJNZ R3,$
DJNZ R4,D1
RET
;====================================
; 行选表
;====================================
TAB: DB 00H,08H,04H,0CH,02H,0AH,06H,0EH,01H,09H,05H,0DH,03H,0BH,07H,0FH
;====================================
; 文字编码表
;====================================
DTAB:
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0DFH,0EEH,0EEH,02H,0FAH,0F6H,0EEH,0C6H,0ABH,6BH,0EFH,0EFH,0EEH,0EEH,0EDH,0EBH
D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