OK now I solved it.
You should wait for null character(s) in serial stream (byte $00) and then execute the following code:
ASM
MOVLW 0x1F
MOVWF PCLATH
GOTO 0x70D
ENDASM
or simple @ GOTO 0 if you test it in the first 2K code segment.
The whole example:
DEFINE LOADER_USED 1 ' uses a bootloader
define OSC 20
DEFINE HSER_BAUD 115200
Char var byte
TXSTA.2=1
SPBRG=10
hserout ["Program Starting...",CR]
ProgramStart:
WHILE 1
CHAR=1
hserin 1,TIMEOUT,[Char]
Timeout:
IF CHAR=0 THEN
ASM
MOVLW 0x1F
MOVWF PCLATH
GOTO 0x70D
ENDASM
' @ GOTO 0 'if this code is in the 1st 2k segment
endif
WEND
Bookmarks