发布网友 发布时间:2022-05-14 16:47
共1个回答
热心网友 时间:2023-10-14 01:51
;16X16LED点阵流动显示
;逐列、逆向(低位开始)扫描
;====================================================================
SDATA_595_1 EQU P2.1 ;串行数据输入
SCLK_595_1 EQU P2.0 ;移位时钟脉冲
RCK_595_1 EQU P2.2 ;输出锁存器控制脉冲
ORG0000H
AJMPMAIN
ORG0030H
MAIN:MOVDPTR,#TAB;字码表初址赋值
MOVR1,#00H;列控制码
MOVR4,#96;移动“ ”及“单片机仿真”6个字符,共96列
CM:MOVR5,#5;每屏反复显示5次
MOVR3,#16;列数
C1:MOVR2,#0;取码指针
C16:MOV60H,#00H
MOV61H,#00H
CALL OUT_595
MOVA,R2
MOVCA,@A+DPTR;取当前列显示字码的第一个字节
MOV60H,A;送1~8行控制口
INCR2
MOVA,R2
MOVCA,@A+DPTR;取当前列的显示字码的第二个字节
MOV61H,A;送9~15行控制口
CALL OUT_595
INCR2
MOVP1,R1;送列控制码
INCR1
ACALLD1MS;显示2MS
ACALLD1MS
DJNZR3,C16;一屏16列是否显示完
MOVR3,#16
DJNZR5,C1;未显示5次,继续
INCDPTR;一屏反复显示5次完,字码表初值加2
INCDPTR
//INCDPTR;一屏反复显示5次完,字码表初值加2
//INCDPTR
DJNZR4,CM;96列未移动完,继续
AJMPMAIN;96列移动完,返回,重新从“ ”开始显示
D1MS:MOVR6,#2
MOVR7,#248
DJNZR7,$
DJNZR6,$-4
RET
;----------------------------------------------------------------------
;输出锁存器输出数据子程序
;----------------------------------------------------------------------
OUT_595:
LCALL WR_595
CLR RCK_595_1
NOP
NOP
SETB RCK_595_1 ;上升沿将数据送到输出锁存器
NOP
NOP
CLR RCK_595_1
RET
;---------------------------------------------------------------------
;移位寄存器接收数据子程序
;---------------------------------------------------------------------
WR_595:
MOV R0,#08H ;
MOV A,61H
WR_LOOP_1:
CLR SCLK_595_1
RLC A
MOV SDATA_595_1,C
SETB SCLK_595_1 ;上升沿发生移位
DJNZ R0,WR_LOOP_1
MOV R0,#08H
MOV A,60H
WR_LOOP_2:
CLR SCLK_595_1
RLC A
MOV SDATA_595_1,C
SETB SCLK_595_1 ;上升沿发生移位
DJNZ R0,WR_LOOP_2
RET
TAB:
DB 000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ;
DB 000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ;" ",
DB 000H ,000H ,000H ,008H ,000H ,008H ,0E0H ,008H ,0F4H ,00DH ,054H ,005H ,0F4H ,07FH ,0F8H ,07FH ;
DB 01EH ,005H ,0FEH ,005H ,0FAH ,006H ,010H ,002H ,000H ,006H ,000H ,004H ,000H ,000H ,000H ,000H ;"单",0
DB 000H ,000H ,000H ,000H ,000H ,010H ,000H ,01CH ,0FCH ,00FH ,0FCH ,003H ,040H ,002H ,040H ,002H ;
DB 07EH ,07FH ,03EH ,07FH ,020H ,000H ,020H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ,000H ;"片",1
DB 000H ,008H ,040H ,00CH ,040H ,006H ,0DCH ,03FH ,0FEH ,03FH ,022H ,011H ,020H ,01DH ,0F0H ,00FH ;
DB 0F0H ,003H ,0F0H ,00FH ,0F0H ,01FH ,010H ,010H ,000H ,01CH ,000H ,01CH ,000H ,010H ,000H ,000H ;"机",2
DB 000H ,001H ,080H ,001H ,0C0H ,000H ,0F0H ,03FH ,0FCH ,03FH ,04CH ,018H ,040H ,00CH ,040H ,027H ;
DB 0CCH ,063H ,0ECH ,079H ,028H ,01FH ,020H ,007H ,020H ,000H ,020H ,000H ,000H ,000H ,000H ,000H ;"仿",3
DB 000H ,000H ,000H ,010H ,000H ,098H ,000H ,0C8H ,0E8H ,06FH ,0E8H ,03FH ,07CH ,01BH ,07EH ,00AH ;
DB 0E6H ,03FH ,0E4H ,07FH ,004H ,06CH ,000H ,004H ,000H ,004H ,000H ,000H ,000H ,000H ,000H ,000H ;"真",4
END