PDA

View Full Version : PBP and assembler mixing - weird goings-on?



Giulio
- 13th November 2006, 19:42
Hi,

I've been dabbling with mixing some asssembler with PBP and can't understand why the following is happening... Consider this code:

;-------------------------------
VAR BYTE loop

main: FOR loop = 0 to n
TOGGLE PORTb.3
NEXT
ASM
_fred
clrw
movwf (anywhere)
movlw .255
movwf (anywhere)
goto _fred
ENDASM

END
;-------------------------------

Sure enough, when this code is run, the loop executes for n times, then the code falls through into the assembly language section, but instead of looping infinitely to _fred, it pops back out and goes back to main: ???

Why is it doing this?

Giulio

khaynes
- 13th November 2006, 20:55
If you have the watchdog timer enabled, the processor will reset and go back to main.

Giulio
- 13th November 2006, 21:17
Aha! Good tip. Wasn't aware of the PBP defaults. Will try. Thanks for the reply!

Giulio