Got it, thanks.
Makes sense
picster
Got it, thanks.
Makes sense
picster
Great!
Did you try to compile code for 16F with RESET_ORG?
YUP, and it worked fineHad to download MPLABX before continuing...
I'll be writing a small program for Windows to xfer the code via RS-232 INTO the I2C EEPROM (which the Pic's main program will manage), in order to test it properly. Weekend stuff.
Will let you know how it works out, but this looks really promising, thanks again!
Take look at microchip AN851. That is VB6 application for bootloader.
I used that as starting point for my VB .net app.
Other solution is to export hex file as text, eg from MPLAB X program windows or some programmer software.
Will have a look - I use VB6 a fair bit so that should work out well. Thx!
Ok, so far so good with a little test program for calling code that's pre-compiled in upper program memory, so I think I'm on track.
Item of note for the 16F series (I'm using the 16F1788):
DEFINE RESET_ORG 36B0h
*****also needs*****
DEFINE USE_LINKER 1
Both lines must be present when generating the "upper memory code" above 800h.
(otherwise there's a compile error re: library exceeding address 800h - found this little gem here:
http://www.picbasic.co.uk/forum/show...+cannot+exceed )
I generated the complied hex, then copied it out of MPLAB, pasted in a text file, did a little search/replace and editing, and pasted the result at the end of the program as ASM as you demonstrated...
used a goto to jump to it at the beginning of my program, and it worked like a charm.
Looking at the resulting compiled hex shows the "upper space subroutine" right where it should be.
I'll let you know how the xfer from i2c goes, but I can't foresee any issues at this rate.
Great!
I started with led blink, and worked from there.
Good luck, and keep us posted![]()
Got an LED flasher working from I2Cread->writecode with the program that performs the update in upper memory per the above.
One subtle difference:
Writecode on a PIC16Fxxxx is word length, so has to be transferred 2 bytes at a time from I2C to ONE codespace address
this works fine, just reading data out of the i2c sequentially as WORDS from every 2nd location:
' Now get data from I2C and write it to codespace
for CodeAddr=0 to 13919
I2CAddr=2*CodeAddr
i2cread PORTB.7, PORTB.6, I2CControl, I2CAddr, [Instruction], I2Cerror
writecode CodeAddr, Instruction
next CodeAddr
Thanks again!
picster
Bookmarks