PDA

View Full Version : How can I call Bootloader from Basic programm?



Kabron
- 13th December 2005, 15:00
I need to pass control to Bootloader(Shipped with MCLoader) from running basic program. I tryed the following: @ goto 0, - the basic program performed restart, but not to the Bootloader. What are the right conditions( jump address, flags, etc.)?

Thanks in advance.

Kabron
- 14th December 2005, 16:42
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

micro
- 14th December 2005, 23:27
excuse me for this equestion because im still newbie
what does Bootloader mean?? and what does that for??
thanks

Kabron
- 15th December 2005, 08:31
excuse me for this equestion because im still newbie
what does Bootloader mean?? and what does that for??
thanks

Take a look here please:
http://www.mecanique.co.uk/products/pic-prog/bootloader.html