Sorry I posted also on Melabs forum, hopeing to quicker reads comments:
I started to have unexpected behaviours in my program with a PIC18F67K22 (128k).
After some days of debugging I finally discovered that troubles happens when I call a piece of code that is above address 19720h
This is a sample program that show what I mean
In this situation it works correctly. If I change to "@ ORG 19730h" it starts to do crazy things, reset, etc
Where can be the problem ?
Thanks
Code:#CONFIG CONFIG RETEN = ON ; Enabled CONFIG INTOSCSEL = LOW ; LF-INTOSC in High-power mode during Sleep CONFIG SOSCSEL = DIG ; CONFIG XINST = OFF ; Disabled CONFIG FOSC = INTIO2 ; Internal RC oscillator CONFIG PLLCFG = OFF ; Enabled #ENDCONFIG OSCCON =110000 ; Primary oscillator, internal 16MHz+PLL. OSCCON2.0 =1 OSCTUNE.7 =1 OSCTUNE.6 =1 ' enable PLL -->> 64MHz Define USE_LFSR 1 DEFINE OSC 64 DEFINE HSER2_RCSTA 90H DEFINE HSER2_TXSTA 24H DEFINE HSER2_BAUD 115200 Led VAR PORTB.3 w0 VAR WORD goto pippo @ ORG 19720h ' (does not work if I change to 19730h or above) pippo: random w0 high led pause 150 low led pause 150 Hserout2["ORG " ,#w0,13,10] goto pippo




Bookmarks