ashwini jayaraman
Member level 2
- Joined
- Jan 17, 2013
- Messages
- 49
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,601
Hello members,
I have written an alp for blinking led..so I have written a subroutine to generate delay of 1.7 s.But I guess there is some logical error...Can anyone debug it???
Here is a subroutine:
DELAY:
MOVLW 0XFF
MOVWF 0X20
LOOP: DECFSZ 0X20,1
CALL DELAY1
RETURN
DELAY1:
MOVLW 0XFF
MOVWF 0X21
LOOP1: DECFSZ 0X21,1
CALL DELAY2
GOTO LOOP1
RETURN
DELAY2:
MOVLW 0X3F
MOVWF 0X22
LOOP2: DECFSZ 0X22,1
GOTO LOOP2
RETURN
Is this logically correct???I mean the calculation...& also have a doubt that Iit may end up as an infinite loop..help me out plz...
I have written an alp for blinking led..so I have written a subroutine to generate delay of 1.7 s.But I guess there is some logical error...Can anyone debug it???
Here is a subroutine:
DELAY:
MOVLW 0XFF
MOVWF 0X20
LOOP: DECFSZ 0X20,1
CALL DELAY1
RETURN
DELAY1:
MOVLW 0XFF
MOVWF 0X21
LOOP1: DECFSZ 0X21,1
CALL DELAY2
GOTO LOOP1
RETURN
DELAY2:
MOVLW 0X3F
MOVWF 0X22
LOOP2: DECFSZ 0X22,1
GOTO LOOP2
RETURN
Is this logically correct???I mean the calculation...& also have a doubt that Iit may end up as an infinite loop..help me out plz...