16乘8点阵滚动问题
时间:10-02
整理:3721RD
点击:
用p1口进行列扫描
用p0和p2配合使用两个74LS373控制(通过p2.1和p2.0选择其中之一)右边的十六个接口 让点阵从左向右滚动显示汉字,为什么 ORG 0100H SETB TR0
MOV SP,#30H
CLR PSW.7
SETB TR0
MOV TMOD,#02H
MOV TL0,#156
MOV TH0,#156
MOV P0,#255
SETB P2.1
CLR P2.0
MOV P1,#1
MOV DPTR,#L4
MOV A,#0
MOV R3,A
ORG 0300H
L1: MOVC A,@A+DPTR
MOV P0,A
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOV A,R3
INC A
MOV R3,A
INC R2
MOV P0,#255
CPL P2.0
CPL P2.1
CJNE R2,#2,L1
MOV R2,#0
MOV A,P1
RLC A
MOV P1,A
MOV A,R3
JNC L1
MOV A,#0
MOV R3,A
MOV A,P1
RLC A
MOV P1,A
MOV A,R3
jb tf0,l2
LJMP L1
L2: CLR TF0
INC R4
CJNE R4,#100,L3
MOV R4,#0
INC R5
CJNE R5,#5,L3
MOV R5,#0
INC R6
MOV 00H,C
MOV 31H,A
MOV A,DPL
ADD A,#02H
MOV DPL,A
MOV A,DPH
ADDC A,#0
MOV DPH,A
MOV C,00H
MOV A,31H
CJNE R6,#48,L3
MOV R6,#0
MOV DPTR,#L4
LJMP L1
L3:LJMP L1
L4:
DB 0FFH ,0FEH ,0FEH, 0F9H ,0EEH, 83H ,0EEH ,0A7H ,80H, 0F3H ,80H, 03H ,0EEH, 0D9H ,0EEH, 0DDH;
DB 0FEH ,0EDH ,0CFH, 0CDH ,0F3H ,9DH ,0F8H, 3DH ,0F0H ,3DH ,0C7H ,8DH ,0DFH ,0EDH ,0FFH ,0FFH;"赵",0
DB 0FFH ,0FFH ,0FFH ,0FDH ,0C0H, 19H ,0DFH ,0E3H ,0D0H ,0FH ,0DFH ,0E7H ,0C0H, 13H ,0FFH, 0EBH;
DB 0F3H ,0E7H ,0F3H ,0CFH ,0F3H ,3FH ,0F0H ,0FDH, 80H ,01H ,0F3H, 0FFH ,0F3H ,0FFH, 0F3H ,0FFH;"财",1
DB 0FFH ,0FFH ,0D8H ,7FH ,0D8H ,7DH ,0DBH ,7DH ,0C3H ,01H ,0C3H ,0FFH ,0FFH ,0FDH, 86H ,0DH;
DB 0B6H ,0DDH ,0B6H ,0DDH ,0B0H ,03H ,0B6H ,0DBH ,0B6H ,0DBH, 86H, 13H ,0FFH ,0F9H ,0FFH ,0FFH;"强",2
db 0FFH ,0FFH, 0FEH ,0F9H, 0EEH ,83H, 0EEH ,0A7H, 80H ,0F3H, 80H ,03H, 0EEH ,0D9H ,0EEH ,0DDH;
END
这一个代码可以实现,而
用p0和p2配合使用两个74LS373控制(通过p2.1和p2.0选择其中之一)右边的十六个接口 让点阵从左向右滚动显示汉字,为什么 ORG 0100H SETB TR0
MOV SP,#30H
CLR PSW.7
SETB TR0
MOV TMOD,#02H
MOV TL0,#156
MOV TH0,#156
MOV P0,#255
SETB P2.1
CLR P2.0
MOV P1,#1
MOV DPTR,#L4
MOV A,#0
MOV R3,A
ORG 0300H
L1: MOVC A,@A+DPTR
MOV P0,A
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOV A,R3
INC A
MOV R3,A
INC R2
MOV P0,#255
CPL P2.0
CPL P2.1
CJNE R2,#2,L1
MOV R2,#0
MOV A,P1
RLC A
MOV P1,A
MOV A,R3
JNC L1
MOV A,#0
MOV R3,A
MOV A,P1
RLC A
MOV P1,A
MOV A,R3
jb tf0,l2
LJMP L1
L2: CLR TF0
INC R4
CJNE R4,#100,L3
MOV R4,#0
INC R5
CJNE R5,#5,L3
MOV R5,#0
INC R6
MOV 00H,C
MOV 31H,A
MOV A,DPL
ADD A,#02H
MOV DPL,A
MOV A,DPH
ADDC A,#0
MOV DPH,A
MOV C,00H
MOV A,31H
CJNE R6,#48,L3
MOV R6,#0
MOV DPTR,#L4
LJMP L1
L3:LJMP L1
L4:
DB 0FFH ,0FEH ,0FEH, 0F9H ,0EEH, 83H ,0EEH ,0A7H ,80H, 0F3H ,80H, 03H ,0EEH, 0D9H ,0EEH, 0DDH;
DB 0FEH ,0EDH ,0CFH, 0CDH ,0F3H ,9DH ,0F8H, 3DH ,0F0H ,3DH ,0C7H ,8DH ,0DFH ,0EDH ,0FFH ,0FFH;"赵",0
DB 0FFH ,0FFH ,0FFH ,0FDH ,0C0H, 19H ,0DFH ,0E3H ,0D0H ,0FH ,0DFH ,0E7H ,0C0H, 13H ,0FFH, 0EBH;
DB 0F3H ,0E7H ,0F3H ,0CFH ,0F3H ,3FH ,0F0H ,0FDH, 80H ,01H ,0F3H, 0FFH ,0F3H ,0FFH, 0F3H ,0FFH;"财",1
DB 0FFH ,0FFH ,0D8H ,7FH ,0D8H ,7DH ,0DBH ,7DH ,0C3H ,01H ,0C3H ,0FFH ,0FFH ,0FDH, 86H ,0DH;
DB 0B6H ,0DDH ,0B6H ,0DDH ,0B0H ,03H ,0B6H ,0DBH ,0B6H ,0DBH, 86H, 13H ,0FFH ,0F9H ,0FFH ,0FFH;"强",2
db 0FFH ,0FFH, 0FEH ,0F9H, 0EEH ,83H, 0EEH ,0A7H, 80H ,0F3H, 80H ,03H, 0EEH ,0D9H ,0EEH ,0DDH;
END
这一个代码可以实现,而
- ORG 0000H
- LJMP 0100H
- ORG 000BH
- LJMP L2
- ORG 0100H
- SETB EA
- SETB ET0
- SETB TR0
- MOV SP,#30H
- CLR PSW.7
- SETB TR0
- MOV TMOD,#02H
- MOV TL0,#156
- MOV TH0,#156
- MOV P0,#255
- SETB P2.1
- CLR P2.0
- MOV P1,#1
- MOV DPTR,#L4
- MOV A,#0
- MOV R3,A
- ORG 0300H
- L1: MOVC A,@A+DPTR
- MOV P0,A
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- MOV A,R3
- INC A
- MOV R3,A
- INC R2
- MOV P0,#255
- CPL P2.0
- CPL P2.1
- CJNE R2,#2,L1
- MOV R2,#0
- MOV A,P1
- RLC A
- MOV P1,A
- MOV A,R3
- JNC L1
- MOV A,#0
- MOV R3,A
- MOV A,P1
- RLC A
- MOV P1,A
- MOV A,R3
- LJMP L1
- L2:
- INC R4
- CJNE R4,#100,L3
- MOV R4,#0
- INC R5
- CJNE R5,#5,L3
- MOV R5,#0
- INC R6
- MOV 00H,C
- MOV 31H,A
- MOV A,DPL
- ADD A,#02H
- MOV DPL,A
- MOV A,DPH
- ADDC A,#0
- MOV DPH,A
- MOV C,00H
- MOV A,31H
- CJNE R6,#48,L3
- MOV R6,#0
- MOV DPTR,#L4
- RETI
- L3:RETI
- L4:
- DB 0FFH ,0FEH ,0FEH, 0F9H ,0EEH, 83H ,0EEH ,0A7H ,80H, 0F3H ,80H, 03H ,0EEH, 0D9H ,0EEH, 0DDH;
- DB 0FEH ,0EDH ,0CFH, 0CDH ,0F3H ,9DH ,0F8H, 3DH ,0F0H ,3DH ,0C7H ,8DH ,0DFH ,0EDH ,0FFH ,0FFH;"赵",0
- DB 0FFH ,0FFH ,0FFH ,0FDH ,0C0H, 19H ,0DFH ,0E3H ,0D0H ,0FH ,0DFH ,0E7H ,0C0H, 13H ,0FFH, 0EBH;
- DB 0F3H ,0E7H ,0F3H ,0CFH ,0F3H ,3FH ,0F0H ,0FDH, 80H ,01H ,0F3H, 0FFH ,0F3H ,0FFH, 0F3H ,0FFH;"财",1
- DB 0FFH ,0FFH ,0D8H ,7FH ,0D8H ,7DH ,0DBH ,7DH ,0C3H ,01H ,0C3H ,0FFH ,0FFH ,0FDH, 86H ,0DH;
- DB 0B6H ,0DDH ,0B6H ,0DDH ,0B0H ,03H ,0B6H ,0DBH ,0B6H ,0DBH, 86H, 13H ,0FFH ,0F9H ,0FFH ,0FFH;"强",2
- db 0FFH ,0FFH, 0FEH ,0F9H, 0EEH ,83H, 0EEH ,0A7H, 80H ,0F3H, 80H ,03H, 0EEH ,0D9H ,0EEH ,0DDH;
- END
来人啊
解决了,采用中断时由于返回原位可能由于比较转移指令影响cy,而采用查询时每次返回开始的地方,使cy重新清零,好像是这么个原因,
不是好像本身就是
程序结构不好,进中断,却不做必要的保护,不是好习惯。
受教受教,自学可能路子有点野