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

Problem presetting data into data EEPROM

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



Joined: 10 Feb 2010
Posts: 9

View user's profile Send private message

Problem presetting data into data EEPROM
PostPosted: Fri Apr 23, 2010 3:20 am     Reply with quote

Hi,

I need to preset some data into data EEPROM and from CCS Help manual, there is something like #rom 0x2100={01,02,03,04,05,06,07}.
I tried it in my program, it couldn't work. Anyone can help?

I am currently using PIC16F1827, compiled with MPLAB PCM V4.106

Thanks
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Apr 23, 2010 4:21 am     Reply with quote

"something like" isn't wrong but not particularly correct for this device.. Address 0x2100 is in the middle of the device's
program flash and actually couldn't work. Microchip has programming specifications for each device. Unfortunately,
the respective document doesn't tell about EEPROM address mapping. I guess, it's 0x8100.
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Fri Apr 23, 2010 7:44 am     Reply with quote

For my 18F14K it's #ROM int8 0xF00000={0x01}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 23, 2010 11:33 am     Reply with quote

The data eeprom address is given in the 16F1827 Programming
Specification, which can be downloaded on this page:
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en538963

See this section:
Quote:

7.3 Data EEPROM
The physical address range of the 256 byte data
memory is 0000h-00FFh. However, these addresses
are logically mapped to address 1E000h-1E1FFh in the
hex file. This provides a way of differentiating between
the data and program memory locations in this range.
The format for data memory storage is one data byte
per address location, LSb aligned.

To get the physical address in the PIC, divide the Hex file address by 2.
This means the data eeprom starts at 0xF000.

You can verify this in the MPLAB simulator by compiling the test program
shown below. Then go to the View menu, and then to EEPROM, and you'll
see it's right there: 01 02 03 04 05
Code:

#include <16F1827.h>
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#rom 0xF000 = {1,2,3,4,5}

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


while(1);
}
pha555



Joined: 17 Sep 2003
Posts: 1

View user's profile Send private message Visit poster's website

PostPosted: Sat Apr 24, 2010 3:49 pm     Reply with quote

Thanks very much PCM programmer.

I spent a good deal of time and solved my problem when I found your post.

Cheers.

Peter Anderson
andrewg



Joined: 17 Aug 2005
Posts: 316
Location: Perth, Western Australia

View user's profile Send private message Visit poster's website

PostPosted: Sat Apr 24, 2010 10:57 pm     Reply with quote

The following works too (in my 4.095, anyway):
Code:
#rom getenv("EEPROM_ADDRESS")={

_________________
Andrew
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