gnupic@linuxhacker.org
gnupic@linuxhacker.org
I think there are two different ways to look at the EEPROM. One is from
the .hex file perspective, or the programming hardware/algorithm. In this
case, I believe it is true that EEPROM is mapped to begin at 0x2100. So
when you are programming a PIC using the serial interface, you'd go to
0x2100 to start entering data into the EEPROM.
The other perspective is that of an actual PIC program. If you write a
program to run on the PIC and want to access the stuff stored in EEPROM,
you start making requests from 0x00 (through the EEADR register or
similar).
Say you put some pre-initialized data into the EEPROM at address 0x2100
while programming the PIC. Then when you start up the PIC and your program
begins to run, it could access that data by putting 0x00 into the EEADR
register and then reading EEDATA (some steps may have been omitted, follow
the actual sequence shown in your data sheet).
So essentially the address you need to use depends on what you're doing:
if you are a program running on the PIC, then use 0x00 as the base
address, and if you're actually programming a PIC, then use 0x2100 (for
the 14-bit parts, of course).
Greg
> According to Microchip data sheets internal data storage EEPROM
> is addressing starts from 0x0. At least PIC programs and PICSTART Plus
> programmer use this base address.
> This may cause a confusion when handling program code and EEPROM data.
> (It is hard to figure out that address 0x22 belongs code or EEPROM area.)
>
> However I found that MPLAB exports EEPROM content into HEX files
> with 0x2100 or 0xf00000 base address (depending on 14/16 bit processor
> architecture).
> I guess the same convention is used when it imports HEX files.
gnupic@linuxhacker.org