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

Writing initial EPROM values when programming pic

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



Joined: 25 Sep 2003
Posts: 7
Location: Uniontown, PA

View user's profile Send private message Send e-mail Visit poster's website

Writing initial EPROM values when programming pic
PostPosted: Thu Jul 08, 2004 7:42 am     Reply with quote

I am using a 16f876 and would like to know if there is a way to set eprom values at the time the pic is programmed.
_________________
Greg
Guest








ROM Values
PostPosted: Thu Jul 08, 2004 7:55 am     Reply with quote

See Page 53 of the CCS manual.

Note that you will have to use the data sheet to set the ROM addess to the address range in the PIC you are using.
=================================
#ROM

Syntax: #rom address = {list};

Elements: address is a ROM word address, list is a list of words
separated by commas

Purpose: Allows the insertion of data into the .HEX file. In
particular, this may be used to program the '84 data
EEPROM, as shown in the following example.
Note that this directive does not prevent the ROM area
from being used. See #ORG to reserve ROM.

Examples: #rom 0x2100={1,2,3,4,5,6,7,8}

Example Files: None

Also See: #org
======================================
valemike
Guest







PostPosted: Thu Jul 08, 2004 7:55 am     Reply with quote

How are you programming the PIC? With Microchip's ICD-2 "hockey puck" shaped device?

I am most comfortable using the MPLAB IDE environment and the ICD-2 for development and programming.

If you want to set the eeprom values, you simply go to MPLAB's IDE, go to the "VIEW" pulldown menu, and select "EEPROM". It then opens up a window showing the contents of EEPROM. You might want to right-click in that window to refresh that display.

You can also click on any cell in that table and it will allow you to edit your EEPROM values. Then you program your chip.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As for preprogramming eeprom from the .c file, I think you might be able to do that, but I have to look it up in the CCS manual.
Guest








PostPosted: Thu Jul 08, 2004 12:31 pm     Reply with quote

The manual and above post states:
"....list is a list of words separated by commas."

Does this mean that each item in the list will require 2 bytes of eprom?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jul 09, 2004 11:56 am     Reply with quote

Quote:
Does this mean that each item in the list will require 2 bytes of eprom?


How about doing a small test?

On a PIC18 I got the following results:
Code:
#ROM 0xF00000 = {1, 2, 3, 4, 5}
0000    01 00 02  00 03 00 04 00 05 00 FF FF FF FF FF FF
This programs 5 word values.
It is possible that on a PIC16 these will be 5 byte values. I'm too lazy to test it.


Code:
#ROM 0xF00010 = {"12345"}
0000    31 32 33 34 35 FF FF FF FF FF FF FF FF FF FF FF

This programs 5 consecutive bytes.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 09, 2004 12:46 pm     Reply with quote

See Neutone's post in this thread, which shows how to write
single bytes with PCH:
http://www.ccsinfo.com/forum/viewtopic.php?t=2437&highlight=rom+int8+eeprom
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jul 13, 2004 5:38 am     Reply with quote

Thanks PCM Programmer!
After reading Neutone's post we have the following 3 methods for defining EEPROM data:

Code:
// Example to set words:
#ROM 0xF00000 = {1, 2, 3, 4, 5}

// Example to set bytes:
#ROM int8 0xF00010 = {1, 2, 3, 4, 5}

// Example to set a string of bytes:
#ROM 0xF00020 = {"12345"}

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