我招着网上书籍上的例题复制编译成功,下载
单片机无效,P2接数码管位选,P0接数码管段选,P3.7接蜂鸣器,P3.2接红外接收管,按下遥控器(
手机支持遥控器功能创维),接收管有电压变化,由4.2降到4.0V。但是为什么数码管,蜂鸣器没有反映?附上代码看看那里有问题?
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,#00011111B
AJMP MAIN
IRD1: CJNE A,#01H,IRD2
MOV P0,#0F9H
MOV P2,#00011111B
AJMP MAIN
IRD2: CJNE A,#02H,IRD3
MOV P0,#0A4H
MOV P2,#00011111B
AJMP MAIN
IRD3: CJNE A,#03H,IRD4
MOV P0,#0B0H
MOV P2,#00011111B
AJMP MAIN
IRD4: CJNE A,#04H,IRD5
MOV P0,#099H
MOV P2,#00011111B
AJMP MAIN
IRD5: CJNE A,#05H,IRD6
MOV P0,#092H
MOV P2,#00011111B
AJMP MAIN
IRD6: CJNE A,#06H,IRD7
MOV P0,#082H
MOV P2,#00011111B
AJMP MAIN
IRD7: CJNE A,#07H,IRD8
MOV P0,#0F8H
MOV P2,#00011111B
AJMP MAIN
IRD8: CJNE A,#08H,IRD9
MOV P0,#080H
MOV P2,#00011111B
AJMP MAIN
IRD9: CJNE A,#09H,IRDOR
MOV P0,#090H
MOV P2,#00011111B
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
[url=]更多操作[/url]
一周热门 更多>