Assignment 04
Assignment 04
QUESTION:
Write a program to glow 16 LEDs one by one of one second in clockwise and then in
anticlockwise direction.
1 RE: MOV A, P0
1 MOV R2, #9 ; Counter for 8 LED's
1 MOV R1, #80H ; For glowing one LED at a time
1 SETB C
1 MOV A, P2
1 MOV R1, #80H
1 MOV R2, #9
1 JUMP2: MOV R0, #28
2 BACK2: ACALL DELAY
2 DJNZ R0, BACK2
2 ACALL FWD2 ; Clockwise glowing of last 8 LEDs
2 DJNZ R2, JUMP2
1 MOV A, P0
1 MOV R1, #01H
1 MOV R2, #9
1 JUMP4: MOV R0, #28
2 BACK4: ACALL DELAY
2 DJNZ R0, BACK4
2 ACALL BWD2 ; Anti-Clockwise glowing of first 8 LEDs
2 DJNZ R2, JUMP4
2 SJMP RE