View previous topic :: View next topic |
Author |
Message |
HGHK
Joined: 29 Jun 2010 Posts: 33
|
Problem: Writing\Reading to\from internal EEPROM |
Posted: Tue Sep 21, 2010 3:30 pm |
|
|
I don't know about EEPROM writing. What is the allowable Address range for writing data. I need a example about it. Help me please.
I use PIC16F876a
Last edited by HGHK on Wed Sep 22, 2010 1:17 am; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2010 4:11 pm |
|
|
Quote: | What is the allowable Address range for writing data ? |
Always post your PIC. We don't remember it from your previous posts.
Look in the front of the data sheet for your PIC. It will list the number
of bytes of data eeprom that are available. For example: 256
The address range is then 0 to 255.
Quote: | I need a example about it.
|
http://www.ccsinfo.com/forum/viewtopic.php?t=43338&start=3 |
|
|
HGHK
Joined: 29 Jun 2010 Posts: 33
|
#rom |
Posted: Wed Sep 22, 2010 6:08 am |
|
|
what is doing of : Quote: |
#rom int8 0xf00000={0x55, 0xAA} |
in your program?
pleas explain that 0x55 , 0xaa, 0xf00000 are refer to what? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 22, 2010 2:13 pm |
|
|
Quote: |
0x55 , 0xaa, 0xf00000 are refer to what?
|
It's a method to pre-load the data eeprom when the PIC is programmed
with your ICD2 (etc.) programmer. So when the PIC first starts running
it will already have eeprom address 0 set to 0x55, and eeprom address 1
will be set to 0xAA. The eeprom address in Flash Memory is found in the
Programming Specification for your PIC. However, see below:
The new method (recommended by several forum members) is to let
the CCS compiler supply the Flash Memory address of the data eeprom.
That way, you don't have to find it in the Programming Specification.
You can do this with the "getenv()" function, as shown below:
Code: |
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#ROM getenv("EEPROM_ADDRESS") = {0x55, 0xAA}
//==========================================
void main()
{
while(1);
}
|
By using this method, you can more easily switch your program to a new
PIC family, such as from 16F to 18F. |
|
|
HGHK
Joined: 29 Jun 2010 Posts: 33
|
write eeprom |
Posted: Tue Sep 28, 2010 1:03 am |
|
|
Only by using write_eeprom without #ROM address={list} I write in eeprom data in PIC16F876A and it not work carefully.
Help me please. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Thu Oct 11, 2012 10:47 am |
|
|
What is the first compiler version that support Quote: | getenv("EEPROM_ADDRESS") |
Mine is 4.114. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 11, 2012 11:38 am |
|
|
Please don't ask eeprom questions all over the forum.
This is your eeprom thread, here:
http://www.ccsinfo.com/forum/viewtopic.php?t=48909
Let's continue working on your eeprom questions there.
Ask your questions in that thread. |
|
|
|