帮忙看看这样的想法做点阵行不行?不行得怎么改目前这个程序达不到要求,但我不知道这样的思维做法对不对
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中锁存
CLR CLK1
DJNZ R3,LOOP1
MOV R4,#00H
MOV R3,#08H
SETB SC1 ;输出行
NOP
CLR SC1
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
CLR CLK2
DJNZ R3,DATR1
MOV R3,#08H
SETB SC2
NOP
CLR SC2 ;输出列
LCALL DEL
LCALL ZH
RET
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,#50
DJNZ R6,$
DJNZ R7,DEL1
RET
TAB: DB 0FFH,81H,81H,81H,81H,81H,81H,0FFH
END |