View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 27, 2008 11:49 am |
|
|
Quote: | I can't find the location of the data EEPROM in a PIC18F4220. |
It's given in the Programming Specification (not the data sheet) for the PIC.
To get the Programming Specification, go to the Data Sheet Finder page:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2046
Select your PIC in the drop-down box. Wait for the page to load.
Then find the link for the Programming spec and download it.
Look in this section:
Quote: | 5.5 Embedding Data EEPROM Information in the HEX File |
|
|
|
romertz
Joined: 03 Oct 2008 Posts: 12 Location: Bogota
|
|
Posted: Wed Apr 22, 2009 10:01 am |
|
|
I want to store info not volatile in the pic eeprom avoiding to use external memory...
I found for my device this info...
Quote: |
Device PIC18F2550
Memory 32K
Pins 28
Boot Block 0007FF
Block 0 001FFF
Block 1 003FFF
Block 2 005FFF
Block 3 007FFF
Block 4 -
Block 5 -
Boot Block 2048
Block 0 6144
Remaining Blocks 24576
Device Total 32768
|
then it means that i must to start the usable memory at 0x080000 (blocks 4-5)?...or the variables or constants of the program also are locate in this site...I mean, those that I don't locate myself... |
|
|
Ttelmah Guest
|
|
Posted: Wed Apr 22, 2009 10:15 am |
|
|
First thing to understand, is that the PIC effectively has three separate 'memory spaces'. The RAM (and your variables therefore), is completely separate from the other memories. Then there is the 'program' flash memory, and finally the EEPROM. The EEPROM, as used inside a program, is 'seen' with it's own addresses from 0 to 255, (or 1023 on some models). However _when programming_, the chip allows this to be programmed as if it sat on the same address bus as the program memory. Where this is, is always defined in the _programming_ specs, _not_ in the normal device info. For most PIC 18 chips, it is at 0xF00000.
What you have printed is the layout of the standard flash program memory, for your chip. It basically runs from address 0, to 0x7FFF. The 'blocks', have significance, only really when dealing with things like write protection for the boot block etc., which individual fuses control. You don't have to get involved in this at all.
All you do to put data into the EEPROM, when programming the chip, is declare a #ROM block at 0xF00000. Nothing else.
Best Wishes |
|
|
romertz
Joined: 03 Oct 2008 Posts: 12 Location: Bogota
|
|
Posted: Wed Apr 22, 2009 12:12 pm |
|
|
well. . .i am a little confused. . . . .
The #rom is used when i want to write constant data, right?. . . .but if I want to write variable data that would be necessary even if the pic has been reseted. . . . I could use the write_eeprom instruction, right?.....but I have not found the document where says this address that I have seen a lot. . .the 0xF00000. . . .but, If I use this rom address, and it works....when I would to write the next byte using write_eeprom, what address must I to point?. . . . I mean, I would use for example write_eeprom(0xf00000,data1), to write a 8 bits data at address 0xf00000, if I want to write another 8 bits data consecutive the last. . .
I would write write_eeprom(0xf00008,data2)?....or how must I to point to the address as the length of the data I have wrote before. . .
Thanks for answer, and sorry if this is obvious.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 22, 2009 12:28 pm |
|
|
Quote: | but I have not found the document where says this address that I have seen a lot. . .the 0xF00000 |
Did you see my post (earlier in this thread) which tells how to find the
Programming Specification ?
Quote: | I mean, I would use for example write_eeprom(0xf00000,data1), to write a 8 bits data at address 0xf00000, if I |
The write_eeprom() and read_eeprom() functions use addresses that
start at 0. The other 0xF00000 address is only used with the #rom
statement.
Example of different ways to write to eeprom:
http://www.ccsinfo.com/forum/viewtopic.php?t=32722 |
|
|
romertz
Joined: 03 Oct 2008 Posts: 12 Location: Bogota
|
|
Posted: Fri Apr 24, 2009 4:42 pm |
|
|
yes right. . . .thanks for your reply . . .i was expecting find in that spec some like start and end....or something that let me know how many memory can i use. . . .i tried with write_eeprom starting in 0 and go until 100. . . .and it seems not have problems. . . .but. . .how could i know the max I can write. . . .
. . . it is working. . . but i am still with the doubt. . . thanks again. . .
. . . lucky is what i wish for you. . . |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
romertz
Joined: 03 Oct 2008 Posts: 12 Location: Bogota
|
|
Posted: Fri Apr 24, 2009 5:01 pm |
|
|
ohhh.....i feel fool seeing that easy.....i guess that looked in the wrong places.....
...thanks very much...bye |
|
|
|