I tested the follow short code piece for a delay with MPLab and had breakpoints at the second decfsz and NOP. The Run command stopped at both. If the decfsz was removed, it stopped at NOP with the desired time on stopwatch. With animate or by stepping into, the program stopped at decfsz when d2 =0, but without decfsz, the program would not go to the NOP. The register for d2 simply rolls over to FF.
Why does Run work, but Animate rolls d2 over to FF? Is there a way to prevent the rollover?
Thanks.
John
Edit: I am using MPLAB 8.10, and the chip is 12F509.
Why does Run work, but Animate rolls d2 over to FF? Is there a way to prevent the rollover?
Thanks.
John
Edit: I am using MPLAB 8.10, and the chip is 12F509.
Code:
;***** VARIABLE DEFINITIONS
d1 equ d'9'
d2 equ d'14'
;**********************************************************************
ORG 0x3FF ; processor reset vector
movlw 0x50
; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
movlw b'11011011'
tris GPIO
movlw b'00000000'
option
start
movlw 0x06
movwf d1
movlw 0x08
movwf d2
Delay_0
decfsz d1,f
goto $+2
decfsz d2,f
goto Delay_0
goto $+1
nop
END ; directive 'end of program'
Last edited: