View previous topic :: View next topic |
Author |
Message |
gbaugh
Joined: 25 Sep 2003 Posts: 7 Location: Uniontown, PA
|
Writing initial EPROM values when programming pic |
Posted: Thu Jul 08, 2004 7:42 am |
|
|
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 |
Posted: Thu Jul 08, 2004 7:55 am |
|
|
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
|
|
Posted: Thu Jul 08, 2004 7:55 am |
|
|
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
|
|
Posted: Thu Jul 08, 2004 12:31 pm |
|
|
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
|
|
Posted: Fri Jul 09, 2004 11:56 am |
|
|
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
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jul 13, 2004 5:38 am |
|
|
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"}
|
|
|
|
|