Các bác giúp e về mạch này....trong sơ đồ nguyên lý port 1.5 1.6 1.7 dùng để lam j...trong chương trình thấy port 1 đâu có tác dụng j
CHƯƠNG TRÌNH CỦA MẠCH
ORG 0000H
MOV P0,#0C0H
MOV P2,#11110000B
CALL DELAY
MOV TMOD,#01H
MAIN:
SETB P3.2
MOV A,#01000000B
X0: JB P3.2,X0
X1: JNB P3.2,X1
X11: JNB P3.2,X1
X2: JB P3.2,X2
MOV TH0,#HIGH(-800)
MOV TL0,#LOW(-800)
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
MOV C,P3.2
JC BIT0
SETB C
RRC A
JC DUNG
SJMP X1
BIT0:
CLR C
RRC A
JC DUNG
SJMP X2
DUNG:
CALL DELAY
RR A
MOV P1,A
PHIM1:
CJNE A,#3,PHIM2
MOV P0,#0F9H
MOV P2,#10111111B
CALL DELAY
JMP MAIN
PHIM2:
CJNE A,#4,PHIM3
MOV P0,#0A4H
MOV P2,#11011111B
CALL DELAY
JMP MAIN
PHIM3:
CJNE A,#5,PHIM4
MOV P0,#0B0H
MOV P2,#11101111B
CALL DELAY
JMP MAIN
PHIM4:
CJNE A,#6,PHIM5
MOV P0,#099H
MOV P2,#01111111B
CALL DELAY
JMP MAIN
PHIM5:
CALL DELAY
MOV P0,#0C0H
MOV P2,#0FFH
JMP MAIN
DELAY:
MOV R2,#5
D0: MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
SETB TR0
JNB TF0,$
CLR TF0
CLR TR0
DJNZ R2,D0
RET
END
CHƯƠNG TRÌNH CỦA MẠCH
ORG 0000H
MOV P0,#0C0H
MOV P2,#11110000B
CALL DELAY
MOV TMOD,#01H
MAIN:
SETB P3.2
MOV A,#01000000B
X0: JB P3.2,X0
X1: JNB P3.2,X1
X11: JNB P3.2,X1
X2: JB P3.2,X2
MOV TH0,#HIGH(-800)
MOV TL0,#LOW(-800)
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
MOV C,P3.2
JC BIT0
SETB C
RRC A
JC DUNG
SJMP X1
BIT0:
CLR C
RRC A
JC DUNG
SJMP X2
DUNG:
CALL DELAY
RR A
MOV P1,A
PHIM1:
CJNE A,#3,PHIM2
MOV P0,#0F9H
MOV P2,#10111111B
CALL DELAY
JMP MAIN
PHIM2:
CJNE A,#4,PHIM3
MOV P0,#0A4H
MOV P2,#11011111B
CALL DELAY
JMP MAIN
PHIM3:
CJNE A,#5,PHIM4
MOV P0,#0B0H
MOV P2,#11101111B
CALL DELAY
JMP MAIN
PHIM4:
CJNE A,#6,PHIM5
MOV P0,#099H
MOV P2,#01111111B
CALL DELAY
JMP MAIN
PHIM5:
CALL DELAY
MOV P0,#0C0H
MOV P2,#0FFH
JMP MAIN
DELAY:
MOV R2,#5
D0: MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
SETB TR0
JNB TF0,$
CLR TF0
CLR TR0
DJNZ R2,D0
RET
END
Comment