ORG 000H
MAIN: MOV SP,#60H
MOV P1,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
JNB P3.2,$
MOV R6,#10
K1: ACALL YS1
JB P3.2,MAIN
DJNZ R6,K1
JNB P3.2,$
ACALL YS2
MOV R1,1AH
MOV R2,#4
PP: MOV R3,#8
JJ: JNB P3.2,$
LCALL YS1
MOV C,P3.2
JNC UU
JB P3.2,$
UU: MOV A,@R1
RRC A
MOV @R1,A
DJNZ R3,JJ
INC R1
DJNZ R2,PP
MOV A,1AH
XRL A,#0
JNZ MAIN
MOV A,1BH
XRL A,#0FFH
JNZ MAIN
MOV A,1CH
CPL A
XRL A,1DH
JNZ MAIN
LCALL SEND
MOV A,1AH
CPL A
MOV P1,A
JZPD: MOV A,1AH
IRD0: CJNE A,#00H,IRD1
MOV P0,#0C0H
MOV P2,#11100000B
AJMP MAIN
IRD1: CJNE A,#01H,IRD2
MOV P0,#0F9H
MOV P2,#11100000B
AJMP MAIN
IRD2: CJNE A,#02H,IRD3
MOV P0,#0A4H
MOV P2,#11100000B
AJMP MAIN
IRD3: CJNE A,#03H,IRD4
MOV P0,#0B0H
MOV P2,#11100000B
AJMP MAIN
IRD4: CJNE A,#04H,IRD5
MOV P0,#099H
MOV P2,#11100000B
AJMP MAIN
IRD5: CJNE A,#05H,IRD6
MOV P0,#092H
MOV P2,#11100000B
AJMP MAIN
IRD6: CJNE A,#06H,IRD7
MOV P0,#082H
MOV P2,#11100000B
AJMP MAIN
IRD7: CJNE A,#07H,IRD8
MOV P0,#0F8H
MOV P2,#11100000B
AJMP MAIN
IRD8: CJNE A,#08H,IRD9
MOV P0,#080H
MOV P2,#11100000B
AJMP MAIN
IRD9: CJNE A,#09H,IRDOR
MOV P0,#090H
MOV P2,#11100000B
AJMP MAIN
IRDOR: MOV P2,#0FFH
AJMP MAIN
YS1: MOV R4,#19
D1: MOV R5,#18
DJNZ R5,$
DJNZ R4,D1
RET
YS2: MOV R4,#10
D2: MOV R5,#216
DJNZ R5,$
DJNZ R4,D2
RET
SEND: MOV R7,255
SDL1: CPL P3.7
MOV R6,#0FFH
SDL0: DJNZ R6,SDL0
DJNZ R7,SDL1
RET
END
这个是论坛的代码复制下来,我测试接收头按下1、2都有下降沿变化。那么接收数据是没有问题,现在是没有响应,晶振用的是11.059,为什么解码不出来? |