View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
programming EEPROM |
Posted: Thu Aug 23, 2012 11:30 am |
|
|
Hi!
Is that possible to write into a EEPROM memory (not program flash memory) directly from a programmer
(MPLAB-PicKit3 in this case), not by running the program. I want to write certain bytes at certain location into an EEPROM along with programming the chip. If it is possible, i'd like to know how.
Thanks in advance! |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Thu Aug 23, 2012 1:17 pm |
|
|
Hi,
Yes, it's possible. Look at the #ROM directive in the CCS Compiler manual.
John |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Thu Aug 23, 2012 2:44 pm |
|
|
and the command:
getenv("EEPROM_ADDRESS")
will give the address needed on any chip (assuming you have a reasonably recent compiler), so you don't have to work out 'where' the EEPROM is in the programming space.
Best Wishes |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Fri Aug 24, 2012 3:41 am |
|
|
Thanks for reply, and how can I read the written data into a ROM. Is that function going to work: read_program_eeprom( )? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Fri Aug 24, 2012 3:52 am |
|
|
No.
READ_EEPROM, and WRITE_EEPROM, are the functions to talk to the data EEPROM.
read_program_eeprom, reads the code memory (hence 'program'), instead.
Best Wishes |
|
|
spilz
Joined: 30 Jan 2012 Posts: 219
|
|
Posted: Tue Oct 09, 2012 3:01 pm |
|
|
Hi,
I don't understand how to use getenv("EEPROM_ADDRESS") and #ROM at the same time
do they have to be in "main" or is it out the code?
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
spilz
Joined: 30 Jan 2012 Posts: 219
|
|
Posted: Tue Oct 09, 2012 3:47 pm |
|
|
thanks for your quick reply,
I try to add it :
Code: | #include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000,restart_wdt)
#ROM getenv("EEPROM_ADDRESS") = {0,0}
|
but when I try to compile (V4.065) I have the error :
do you have an idea about this problem? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 09, 2012 4:02 pm |
|
|
Quote: | but when I try to compile (V4.065) I have the error
|
It doesn't work with that version. It's too old. Use this line instead:
Code: |
#rom int8 0xF00000 = {0,0} |
|
|
|
|