- Back to Home »
- traffic light »
- program for traffic light
org 0000h
mov P2,#00H
MOV P1,#00H
AGAIN: SETB P2.2
CLR P2.1
CLR P2.0
SETB P2.3
CLR P2.4
CLR P2.5
SETB P1.0
SETB P1.4
CLR P2.6
CLR P2.7
CLR P1.1
CLR P1.3
ACALL DELAY
CLR P2.2
SETB P2.1
CLR P2.3
SETB P2.4
ACALL DELAY1
CLR P2.1
SETB P2.0
CLR P2.4
SETB P2.5
SETB P2.6
SETB P1.1
CLR P1.4
CLR P1.0
ACALL DELAY
CLR P1.1
CLR P2.6
SETB P2.7
SETB P1.3
ACALL DELAY1
SJMP AGAIN
Delay:mov r0,#0ffh
l1: mov r1,#0ffh
l: mov r2,#10h
djnz r2,$
djnz r1,l
djnz r0,l1
RET
delay1:mov r0,#0ffh
l2: mov r1,#0ffh
l3: mov r2,#04h
djnz r2,$
djnz r1,l3
djnz r0,l2
ret
end