nhờ mọi người hướng dẫn em lập trình sao cho mình chạy 3 vòng tròn led.dùng 3 vi điều khiển.đã kết nối p0.0 vdk này với p3.7 vdk kia.làm sao mà khi vdk chạy hết 1 vòng rồi tự động nhảy qua vdk thứ 2 chạy hết vòng rồi nhảy qua vdk3.hướng dẫn em cách viết để nhảy vdk với
cảm ơn nhiều ạ
ORG 0000H
MOV TMOD,#10H
;******************************
;TAT TAT CA CAC LED
;******************************
START:
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV P3,#00H
ACALL DELAY_2S
;*******************************
;SANG DAN TUNG LED TU TRAI SANG PHAI
;*******************************
MOV P0,#00H
SETB P0.0
ACALL DELAY_1S
SETB P0.1
ACALL DELAY_1S
SETB P0.2
ACALL DELAY_1S
SETB P0.3
ACALL DELAY_1S
SETB P0.4
ACALL DELAY_1S
SETB P0.5
ACALL DELAY_1S
SETB P0.6
ACALL DELAY_1S
SETB P0.7
ACALL DELAY_1S ;DONG THU 50
MOV P1,#00H
SETB P1.0
ACALL DELAY_1S
SETB P1.1
ACALL DELAY_1S
SETB P1.2
ACALL DELAY_1S
SETB P1.3
ACALL DELAY_1S
SETB P1.4
ACALL DELAY_1S
SETB P1.5
ACALL DELAY_1S
SETB P1.6
ACALL DELAY_1S
SETB P1.7
ACALL DELAY_1S
MOV P2,#00H
SETB P2.0
ACALL DELAY_1S
SETB P2.1
ACALL DELAY_1S
SETB P2.2
ACALL DELAY_1S
SETB P2.3
ACALL DELAY_1S
SETB P2.4
ACALL DELAY_1S
SETB P2.5
ACALL DELAY_1S
SETB P2.6
ACALL DELAY_1S
SETB P2.7
ACALL DELAY_1S
MOV P3,#00H
SETB P3.0
ACALL DELAY_1S
SETB P3.1
ACALL DELAY_1S
SETB P3.2
ACALL DELAY_1S
SETB P3.3
ACALL DELAY_1S
SETB P3.4
ACALL DELAY_1S
SETB P3.5
ACALL DELAY_1S
SETB P3.6
ACALL DELAY_1S
SETB P3.7 ;DONG 100
ACALL DELAY_1S
;******************************
DELAY_50MS:MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
SETB TR0
L1:JNB TF0,L1
CLR TF0
RET
;******************************
DELAY_500MS:MOV R1,#10
L2:ACALL DELAY_50MS
DJNZ R1,L2
RET
;********************************
DELAY_1S: MOV R0,#2
L3: ACALL DELAY_500MS
DJNZ R0,L3
RET
;********************************
DELAY_2S: MOV R0,#4
L4: ACALL DELAY_500MS
DJNZ R0,L4
RET
;*******************************
DELAY_5S: MOV R0,#10
L5: ACALL DELAY_500MS
DJNZ R0,L5
RET
END
'
cảm ơn nhiều ạ
ORG 0000H
MOV TMOD,#10H
;******************************
;TAT TAT CA CAC LED
;******************************
START:
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV P3,#00H
ACALL DELAY_2S
;*******************************
;SANG DAN TUNG LED TU TRAI SANG PHAI
;*******************************
MOV P0,#00H
SETB P0.0
ACALL DELAY_1S
SETB P0.1
ACALL DELAY_1S
SETB P0.2
ACALL DELAY_1S
SETB P0.3
ACALL DELAY_1S
SETB P0.4
ACALL DELAY_1S
SETB P0.5
ACALL DELAY_1S
SETB P0.6
ACALL DELAY_1S
SETB P0.7
ACALL DELAY_1S ;DONG THU 50
MOV P1,#00H
SETB P1.0
ACALL DELAY_1S
SETB P1.1
ACALL DELAY_1S
SETB P1.2
ACALL DELAY_1S
SETB P1.3
ACALL DELAY_1S
SETB P1.4
ACALL DELAY_1S
SETB P1.5
ACALL DELAY_1S
SETB P1.6
ACALL DELAY_1S
SETB P1.7
ACALL DELAY_1S
MOV P2,#00H
SETB P2.0
ACALL DELAY_1S
SETB P2.1
ACALL DELAY_1S
SETB P2.2
ACALL DELAY_1S
SETB P2.3
ACALL DELAY_1S
SETB P2.4
ACALL DELAY_1S
SETB P2.5
ACALL DELAY_1S
SETB P2.6
ACALL DELAY_1S
SETB P2.7
ACALL DELAY_1S
MOV P3,#00H
SETB P3.0
ACALL DELAY_1S
SETB P3.1
ACALL DELAY_1S
SETB P3.2
ACALL DELAY_1S
SETB P3.3
ACALL DELAY_1S
SETB P3.4
ACALL DELAY_1S
SETB P3.5
ACALL DELAY_1S
SETB P3.6
ACALL DELAY_1S
SETB P3.7 ;DONG 100
ACALL DELAY_1S
;******************************
DELAY_50MS:MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
SETB TR0
L1:JNB TF0,L1
CLR TF0
RET
;******************************
DELAY_500MS:MOV R1,#10
L2:ACALL DELAY_50MS
DJNZ R1,L2
RET
;********************************
DELAY_1S: MOV R0,#2
L3: ACALL DELAY_500MS
DJNZ R0,L3
RET
;********************************
DELAY_2S: MOV R0,#4
L4: ACALL DELAY_500MS
DJNZ R0,L4
RET
;*******************************
DELAY_5S: MOV R0,#10
L5: ACALL DELAY_500MS
DJNZ R0,L5
RET
END
'
Comment