SC1 BIT P1.2
CLK1 BIT P1.1
SEN1 BIT P1.0
SC2 BIT P2.2
CLK2 BIT P2.1
SEN2 BIT P2.0
ORG 0000H
AJMP MAIN
NOP
ORG 0030H
MAIN: MOV R0,#00H
MOV R2,#80H ;第一行地址
MOV R3,#08H ;移八次
MOV R4,#00H ;中间地址
MOV R5,#08H
MOV 30H,#00H
//MOV 31H,#00H
LOOP: MOV 30H,R2
MOV R4,30H ;输入第一行地址
LOOP1: MOV A,R4
RLC A
MOV R4,A
MOV SEN1,C
SETB CLK1 ;移八次把行地址移入595中锁存
NOP
CLR CLK1
DJNZ R3,LOOP1
MOV R4,#00H
MOV R3,#08H
SETB SC1 ;输出行
NOP
CLR SC1
LCALL DEL
DATR: MOV DPTR,#TAB
MOV A,@R0
INC R0
MOVC A,@A+DPTR
MOV R4,A
DATR1: MOV A,R4
RLC A
MOV R4,A
MOV SEN2,C
SETB CLK2
NOP
CLR CLK2
DJNZ R3,DATR1
MOV R3,#08H
SETB SC2
NOP
CLR SC2 ;输出列
LCALL DEL
LCALL ZH
AJMP MAIN
ZH: MOV A,R2 ;循环扫描下一列,给下一行地址赋值
RR A
MOV R2,A
DJNZ R5,ZHEND
MOV R5,#08H
MOV R2,#80H
MOV R0,#00H
ZHEND: RET
DEL: MOV R7,#10
DEL1: MOV R6,#10
DJNZ R6,$
DJNZ R7,DEL1
RET
TAB: DB 00H,6CH,92H,82H,44H,28H,10H,00H
END
|