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 CCS Technical Support

INIT eeprom with int32 values (#ROM INT32 adr=.....)

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



Joined: 27 May 2004
Posts: 12
Location: Austria

View user's profile Send private message Send e-mail

INIT eeprom with int32 values (#ROM INT32 adr=.....)
PostPosted: Wed Jun 25, 2008 1:52 am     Reply with quote

hello,

i think the title say it all:

i want to initialize the eeprom with int32 data, without splitting the 4 - byte data by hand before.

#rom int32 adr = { does not work.

someone in the forum is speaking of a
GET_EEPROM function. so is there a SET_EEPROM as well?

thank you for your help.[/b]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 25, 2008 11:29 am     Reply with quote

Do you want to put the values in "data eeprom" or in "flash program memory" ? Look in the PIC data sheet to understand the difference
between these two types of memory.

Also, what PIC are you using ?
YUM



Joined: 27 May 2004
Posts: 12
Location: Austria

View user's profile Send private message Send e-mail

PostPosted: Thu Jun 26, 2008 12:48 am     Reply with quote

good morning!

i use:
PIC16F877A and data eeprom (256 bytes, starting at address 0x2100)
compiler ver. 3.227
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 26, 2008 1:33 am     Reply with quote

You could invent a macro to split up the int32 into individual bytes.
Example:
Code:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#define Split(x) x >> 24, x >> 16, x >> 8, x

#rom 0x2100 = {Split(0x01234567), Split(0x89ABCDEF) }

//====================================
void main()
{


while(1);
}


This gives the following result in the eeprom window in MPLAB:
Code:
0000  01 23 45 67 89 AB CD EF FF FF FF FF FF FF FF FF
YUM



Joined: 27 May 2004
Posts: 12
Location: Austria

View user's profile Send private message Send e-mail

PostPosted: Thu Jun 26, 2008 3:40 am     Reply with quote

thank you, PCM Programmer, this is feasible, though there does not seem to be a direct way to do it.

yum
Guest








PostPosted: Wed Jul 23, 2008 12:05 am     Reply with quote

Just for information, the PIC16F88's data eeprom starts at address 0x2100 as well.

#rom 0x2100={1,2,3,4,5,6,7,8,9,0} // fills the start of the EEPROM space with said numbers
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