|
|
View previous topic :: View next topic |
Author |
Message |
Bill_Smith
Joined: 06 Feb 2004 Posts: 26 Location: Curitiba, Brazil
|
READING AND WRITING TO INTERNAL DATA EEPROM |
Posted: Sat May 14, 2005 12:20 pm |
|
|
I started a new project where I need to store and recall data from the PIC12F683's DATA EEPROM. I am using one of the 14-pin emulator plug-ins since the PIC12F683 doesn't have hardware support for in-circuit debugging. I wrote the following code to test this function, however I cannot read back any data that I load with the #rom statement, nor with write_eeprom(address,data) functions within the program. At first, I suspected that the emulation device was somehow blocking writes to EEPROM, so I explicitly set the WREN bit in the EEPROM's control register, but no change. Finally, I switched to a PIC18F458 target to test the program, but it reacted the same. Now I know that I must be doing something stupid, can anyone shed some light on what I'm missing?
Thank you.
Code: |
#include <12F683.h>
#device ADC=10
#fuses INTRC_IO,NOWDT,NOPROTECT,MCLR,NOBROWNOUT,NOCPD
#use delay(clock=8000000) // 8MHz Clock
#zero_ram
#rom 0x2100={0x55,0x33,0xF0,0xC3}
int8 EEDATA[5];
void main ()
{
setup_oscillator(OSC_8MHZ,0); // 8MHz Internal RC Oscillator
EEDATA[0]=read_eeprom(0x00);
EEDATA[1]=read_eeprom(0x01);
EEDATA[2]=read_eeprom(0x02);
EEDATA[3]=read_eeprom(0x03);
while(TRUE)
{
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 14, 2005 1:14 pm |
|
|
Read this thread and try the 18F458 test that I've posted there.
http://www.ccsinfo.com/forum/viewtopic.php?t=22191
You didn't show a test program for the 18F458, so I'm not sure if
you're using the correct EEPROM address. The address is 0xF00000
for the 18F458. Example:
#rom 0xF00000={0x55,0x33,0xF0,0xC3}
If you can't make it work, then post your version of the compiler. |
|
|
|
|
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
|