Hello everyboby, I'm having a problem with the instruction DECFSZ.
Here is my code:
' inc P16F628'
delay EQU 0x20
count EQU 0x21
...
...
main
movlw 0x0F
movwf PORTB ; rb3 to rb0 LEDs ON
movlw 0x3 ;set value 3 to count register
movwf count ;
bcf PORTB,3 ; rb3 LED off
loop
CALL delay ; 1 sec
RRF PORTB ; rb2 LED off....
decfsz count,f ;
goto loop ;
.
. .carry on here when LED rb3, rb2, rb1 are off AND rb0 is on
When the count has decremented to zero it doesnt skip to the next part of the program. It rolls over to 0xff and carries on looping. Im sure there is a simple answer.Please help. Thankyou
Here is my code:
' inc P16F628'
delay EQU 0x20
count EQU 0x21
...
...
main
movlw 0x0F
movwf PORTB ; rb3 to rb0 LEDs ON
movlw 0x3 ;set value 3 to count register
movwf count ;
bcf PORTB,3 ; rb3 LED off
loop
CALL delay ; 1 sec
RRF PORTB ; rb2 LED off....
decfsz count,f ;
goto loop ;
.
. .carry on here when LED rb3, rb2, rb1 are off AND rb0 is on
When the count has decremented to zero it doesnt skip to the next part of the program. It rolls over to 0xff and carries on looping. Im sure there is a simple answer.Please help. Thankyou