T3STY
Full Member level 4
![Full Member level 4](/styles/images/ranks/flevel1.gif)
I am having a delay routine that goes like this:
The whole value within the 3bytes is 1 million which from calculations it should waste 1 second on a 4MHz main clock (1MHz real). Although, when I run this code it will end before 1 million cycles (actually, pretty fast) and I suppose the DECFSZ instruction only works on the first byte of variable _delay.
Thus the question: operations on variables larger than 1 byte will affect only the first byte of the variable? If not, what's wrong in the code I wrote that makes it vanish so fast?
Code:
Delay
ORG 0x0C
_delay RES 3
MOVLW 0x40
MOVWF _delay
MOVLW 0x42
MOVWF _delay+1
MOVLW 0x0F
MOVWF _delay+2
_delay_loop
DECFSZ _delay, f
GOTO _delay_loop
RETURN
Thus the question: operations on variables larger than 1 byte will affect only the first byte of the variable? If not, what's wrong in the code I wrote that makes it vanish so fast?