CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

programming EEPROM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

programming EEPROM
PostPosted: Thu Aug 23, 2012 11:30 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 23, 2012 1:17 pm     Reply with quote

Hi,

Yes, it's possible. Look at the #ROM directive in the CCS Compiler manual.

John
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Thu Aug 23, 2012 2:44 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 24, 2012 3:41 am     Reply with quote

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: 19359

View user's profile Send private message

PostPosted: Fri Aug 24, 2012 3:52 am     Reply with quote

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: 218

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 3:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 3:18 pm     Reply with quote

This thread has an example of using #rom with getenv for the data eeprom:
http://www.ccsinfo.com/forum/viewtopic.php?t=43607&start=2
spilz



Joined: 30 Jan 2012
Posts: 218

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 3:47 pm     Reply with quote

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 :
Code:
Invalid ORG range


do you have an idea about this problem?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 09, 2012 4:02 pm     Reply with quote

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}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group