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

PIC18F4220 data eeprom address

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








PIC18F4220 data eeprom address
PostPosted: Sun Jul 27, 2008 4:59 am     Reply with quote

I am gong mad! Can't find the location of the data EEPROM in a PIC18F4220. I tried the usual

#rom 0x2100 = {1,2,3} but it (CCS ICD) won't verify the data so I assume the address is incorrect?

I just want to init the eeprom data at program time. I can read_eeprom and write_eeprom OK so the device seems fine.

Any help much appreciated.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Sun Jul 27, 2008 8:15 am     Reply with quote

Try 0xF00000
_________________
David
foodwatch



Joined: 18 Apr 2006
Posts: 66

View user's profile Send private message Yahoo Messenger

PostPosted: Sun Jul 27, 2008 11:08 am     Reply with quote

I use the 18F4550 and the data eeprom begins at 0xf00000. Not sure about yours
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 27, 2008 11:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 22, 2009 10:01 am     Reply with quote

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







PostPosted: Wed Apr 22, 2009 10:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 22, 2009 12:12 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 22, 2009 12:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 4:42 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 4:49 pm     Reply with quote

Look at this table (on page 5) in the 18F4220 Programming specification:
Quote:
TABLE 2-2: IMPLEMENTATION OF CODE MEMORY

It shows the address range (start and end) for the Data eeprom.
http://ww1.microchip.com/downloads/en/DeviceDoc/39592e.pdf
romertz



Joined: 03 Oct 2008
Posts: 12
Location: Bogota

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 5:01 pm     Reply with quote

ohhh.....i feel fool seeing that easy.....i guess that looked in the wrong places.....

...thanks very much...bye
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