串行存储器拷贝器的工作原理及制作
汇编源程序
ORG 0000H
LJMP MAIN
ORG 002DH
MAIN:MOV SP,#40H
MOV 34H,#0FFH
MOV P1,0FFH
M1: CPL P1.2
LCALL YS
JB P1.3,M1
LCALL YS
JB P1.3,M1
M2: JNB P1.3,M2
CLR P1.2
MOV R7,#04H
MOV R6,#10H
MOV 30H,#0A0H
M14: MOV 32H,#00H
M13: MOV 31H,#40H
MOV R1,#20H
MA: DJNZ 31H,M4
MOV 34H,#88H
LJMP M1
M4: LCALL QD
MOV A,30H
LCALL FA
JNB F0,M3
SJMP MA
M3: MOV A,32H
LCALL FA
JB F0,MA
LCALL QD
MOV A,30H
ADD A,#01H
LCALL FA
JB F0,MA
M7: LCALL DU
MOV @R1,A
CJNE R1,#2FH,M5
LCALL FYD
LCALL TZ
SJMP M6
M5: LCALL YD
INC R1
SJMP M7
M6: MOV 31H,#0FFh
MOV R1,#20H
M9: DJNZ 31H,M8
MOV 34H,#30H
LJMP M1
M8: LCALL QD
MOV A,30H
ADD A,#08h
LCALL FA
JB F0,M9
MOV A,32H
LCALL FA
JB F0,M9
M15: MOV A,@R1
LCALL FA
JB F0,M9
CJNE R1,#2FH,M10
LCALL TZ
MOV 34H,#0AH
LCALL YS
DJNZ R6,M11
DJNZ R7,M12
NOP
NOP
NOP
LJMP MAIN
M10: INC R1
SJMP M15
M11: MOV A,32H
ADD A,#10H
MOV 32H,A
LJMP M13
M12: MOV A,30H
ADD A,#02H
MOV 30H,A
LJMP M14
ORG 0200H
YS: MOV R5,34H
LOOP1:MOV R4,#0FFH
LOOP2:DJNZ R4,LOOP2
DJNZ R5,LOOP1
RET
ORG 0100H
QD: SETB P1.7
SETB P1.6
NOP
NOP
CLR P1.7
NOP
NOP
CLR P1.6
RET
ORG 0140H
FA: MOV R0,#08H
FA2: RLC A
JC FA1
SJMP FA3
FA4:DJNZ R0,FA2
SJMP FA5
FA1:SETB P1.7
SETB P1.6
NOP
NOP
CLR P1.6
CLR P1.7
SJMP FA4
FA3:CLR P1.7
SETB P1.6
NOP
NOP
CLR P1.6
SJMP FA4
FA5:SETB P1.7
SETB P1.6
CLR F0
MOV A,P1
JNB ACC.7,FA6
SETB F0
FA6:CLR P1.6
NOP
RET
DU:MOV R0,#08H
DU2:SETB P1.7
SETB P1.6
MOV A,P1
JNB ACC.7,DU0
SJMP DU1
DU3:DJNZ R0,DU2
RET
DU0:CLR C
MOV A,R2
RLC A
MOV R2,A
CLR P1.6
SJMP DU3
DU1:SETB C
MOV A,R2
RLC A
MOV R2,A
CLR P1.6
SJMP DU3
ORG 0110H
TZ:CLR P1.7
SETB P1.6
NOP
NOP
SETB P1.7
NOP
NOP
CLR P1.6
RET
ORG 0120
YD:CLR P1.7
SETB P1.6
NOP
NOP
CLR P1.6
NOP
NOP
SETB P1.7
RET
ORG 0130H
FYD:SETB P1.7
SETB P1.6
NOP
NOP
CLR P1.6
CLR P1.7
RET
END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)