Jumper,
I made the .lib modification and modified your code to read back 16 memory locations starting at 60106. Data coming back from the read is all FF's, so it looks like there's no program located there.
Comments?
Joe
================================================== ======
DEFINE MAKE_LOADER 1 'Code will begin at 60160
DEFINE HSER_RXSTA 90h
define HSER_TXSTA 24h
DEFINE HSER_BAUD 9600
define OSC 8
OSCCON = $FF
TRISB=%00111111
TRISC=%10111111
RB6 var PORTB.6
RB7 var PORTB.7
TX Var PORTC.6
RX Var PORTC.7
'************************************************* ********************************************
I VAR BYTE
x var byte
Flash var word
Temp var word
'************************************************* ********************************************
Goto INIT
'************************************************
jump_back:
'Flash=64
'READCODE flash, temp 'Read the value at Flash adr
'IF temp=$FFFF then STOP 'If it is $FFFF we have no application code in the PIC so STOP
'@ GOTO 0x0040 'Start application
'*************************************************
'Here we decide if we should enter the Loader or not receiving a byte.
INIT: Pause 200 'wait for things to settle
Rb6=1 'indicate we are waiting for a character
HSERin [x] 'if nothing after 5 sek go to jump_back
if x="L" then
PAUSE 100
Goto Loader
ENDIF 'If it is what we want to get then enter the laoder
goto Jump_Back 'everything else jump_back
'************************************************* ****************
Loader:
FOR I = 0 TO 15
READCODE (60610 + I),X
hserout [$0D, $0A, ":", HEX(X)," "]
NEXT I
RB7=1 'Indicate we have entered the Loader
RB6=0
pause 200
'Here we can recieve new data and write it to the FLASH
'Erase before writing and write full blocks 64 bytes
'
goto Jump_Back 'When finished goto
END
'************************************************* ********
Bookmarks