Ducados
Junior Member level 1
pickit 2/ 16f690/ mplab ide
I'm having trouble with loops now that I'm trying to write my own code, I want to use decfsz because it doesn't reset any flags, all they examples I see use f as destination but I can only get the loops to function with w as the destination or a mixture of f and w in nested loops.
here's an example of the code, it never leaves loop2 unless I replace the f with w.
mainloop:
movlw b'000001'
movwf 07h
; timing delay >
movlw d'3'
loop2 movwf v1
movlw b'000010'
movwf 07h
; timing delay>
decfsz v1,f
goto loop2
goto mainloop
I'm having trouble with loops now that I'm trying to write my own code, I want to use decfsz because it doesn't reset any flags, all they examples I see use f as destination but I can only get the loops to function with w as the destination or a mixture of f and w in nested loops.
here's an example of the code, it never leaves loop2 unless I replace the f with w.
mainloop:
movlw b'000001'
movwf 07h
; timing delay >
movlw d'3'
loop2 movwf v1
movlw b'000010'
movwf 07h
; timing delay>
decfsz v1,f
goto loop2
goto mainloop