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 support@ccsinfo.com

READING AND WRITING TO INTERNAL DATA EEPROM

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



Joined: 06 Feb 2004
Posts: 26
Location: Curitiba, Brazil

View user's profile Send private message Visit poster's website

READING AND WRITING TO INTERNAL DATA EEPROM
PostPosted: Sat May 14, 2005 12:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 14, 2005 1:14 pm     Reply with quote

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.
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