ORG 00H
START: MOV A,#0FFH
MOV P0,A ;清除P0口
ANL P3,#00 ;清除P2口
MOV R2,#200
D1: MOV R3,#248 ;延时
DJNZ R3,$
DJNZ R2,D1
MOV 20H,#00H ;取码指针的初值
l1: MOV R1,#100 ;每个字的停留时间
L2: MOV R6,#16 ;每个字16个码
MOV R4,#00H ;扫描指针清零
MOV R0,20H ;取码指针存入R0
L3: MOV A,R4 ;扫描指针存入A
MOV P1,A ;开三极管扫描输出
INC R4 ;扫描下一个
MOV A,R0
MOV DPTR,#TABLE ;取数据代码上半部分
MOVC A,@A+DPTR
MOV P0,A ;查表送P0口
INC R0
MOV A,R0
MOV DPTR,#TABLE ;取数据代码下半部分
MOVC A,@A+DPTR
MOV P3,A ;查表送P2口
INC R0
MOV R3,#02
D2: MOV R5,#248
DJNZ R5,$
DJNZ R3,D2
MOV A,#00H
MOV P0,A
ANL P3,#00H
DJNZ R6,L3 ;16个码是否完成?
DJNZ R1,L2 ;每个字的停留时间是否到了?
MOV 20H,R0
CJNE R0,#0FFH,L1 ;4个字的256个码检测是否送完 ?
JMP START
TABLE:
DB 24H,08H,24H,10H,24H,60H,25H,80H
DB 7FH,0FFH,0C5H,00H,44H,80H,00H,40H ;“科”
DB 24H,40H,12H,40H,00H,40H,0FFH,0FFH
DB 00H,80H,01H,80H,00H,80H,00H,00H
DB 08H,20H,08H,22H,08H,41H,0FFH,0FEH
DB 08H,80H,08H,01H,11H,81H,11H,62H ;“技”
DB 11H,14H,0FFH,08H,11H,14H,11H,64H
DB 31H,82H,10H,03H,00H,02H,00H,00H
END
|