EmbeddedRelated.com
Forums

Example code in C for R/W data to EEPROM

Started by comus June 13, 2005
Hello all,

i'm trying to write data into the EEPROM of the PIC 16f877A.

I use the CCS-Compler Version 3.219 and an 16f877a with 368kb memory.

as i want to use the eeprom to store static data i want write into and
read from the eeprom. i used the "internal_eeprom.h" from ccs but with
no result, i can't read an write anything.

can someone post some code example to read and write? do i have to use
"#org"? 

please help me!!

On 13 Jun 2005 04:01:01 -0700, "comus" <comus@freenet.de> wrote:

>Hello all, > >i'm trying to write data into the EEPROM of the PIC 16f877A. > >I use the CCS-Compler Version 3.219 and an 16f877a with 368kb memory.
368kb memory on PIC ??????
> >as i want to use the eeprom to store static data i want write into and >read from the eeprom. i used the "internal_eeprom.h" from ccs but with >no result, i can't read an write anything. > >can someone post some code example to read and write? do i have to use >"#org"? > >please help me!!
In article <1118657396.535216.146710@g47g2000cwa.googlegroups.com>, 
comus@freenet.de says...
> Hello all, > > i'm trying to write data into the EEPROM of the PIC 16f877A. > > I use the CCS-Compler Version 3.219 and an 16f877a with 368kb memory. > > as i want to use the eeprom to store static data i want write into and > read from the eeprom. i used the "internal_eeprom.h" from ccs but with > no result, i can't read an write anything. > > can someone post some code example to read and write? do i have to use > "#org"? > > please help me!! > >
You don't need to do anything other than use the built in functions to read and write the internal eeprom. value = read_eeprom (address) write_eeprom (address, value) address = 0x00 - 0xff, for the 877 value == 8bit value to write into the eeprom Remember, these commands (especially the write) may take several milliseconds to complete. All of this is available from the IDE and the manual. Jim