Cuongysl
Newbie level 3
- Joined
- Aug 2, 2015
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 21
I'm start to learn 8051 by designing a blinking LED circuit. One of my effect seems to have problem, I think it is because of my code because other effects worked. Please help me check if there is something missing
Code:
Effect2:
mov r1,#5
start2:
mov a,#0FFh
port0:
rlc a
lcall sdelay
mov P0,a
cjne a,#00h,port0
mov a,#0FFh
port1:
rlc a
lcall sdelay
mov P1,a
cjne a,#00h,port1
mov a,#0FFh
port2:
rlc a
lcall sdelay
mov P2,a
cjne a,#00h,port2
mov a,#0FFh
port3:
rlc a
lcall sdelay
mov P3,a
cjne a,#00h,port3
lcall sdelay
lcall off ;turn off
djnz r1,start2
ret
off:
mov a,#0FFh ;turn all led off
mov P0,a
mov P1,a
mov P2,a
mov P3,a
ret
sdelay: ;short delay subroutine
mov r7,#150
L1: mov r6,#100
L2: mov r5,#2
L3: djnz r5,$
djnz r6,L2
djnz r7,L1
ret