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

Write_EEPROM

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



Joined: 06 May 2004
Posts: 19
Location: Italy

View user's profile Send private message

Write_EEPROM
PostPosted: Mon Jun 14, 2004 7:22 am     Reply with quote

HI

V 3.184
PIC16F876

I have to read internal eeprom after power-up operation, but sometimes
PIC read 255 and not my personal data:
Code:

static int init;

MAIN()
 {
 //   CONFIGURATION
                  ....
 Init=read_eeprom(0);

   if (init ...

}

Can you help me?
Thank
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 11:58 am     Reply with quote

Here is a demo program to test reading the internal EEPROM.
I tested it with PCM vs. 3.184, and it worked. It displayed this
on the terminal window:

55 AA 01 23 45 67 89


Try the program below. Also, make sure you have the PUT and
BROWNOUT fuses set, as shown below. It's possible that your
problem is related to the power supply rise and fall times.
If you set those two fuses, it should fix the problem.
Code:

#include <16F876.H>
#fuses XT, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use Delay(Clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, Errors)

// Put some data into internal EEPROM.
#rom 0x2100 = {0x55, 0xAA, 0x01, 0x23, 0x45, 0x67, 0x89}

//=========================================
main()
{
char value;
char addr;

// Read the internal data eeprom and display the values.
for(addr = 0; addr < 7; addr++)
   {
    value = read_eeprom(addr);
    printf("%x ", value);
   }

printf("\n\r");

while(1);
}

-------------
Edit: Put the program in a code block for easier reading.


Last edited by PCM programmer on Sun Apr 06, 2008 10:13 pm; edited 1 time in total
Guest








PostPosted: Fri Jun 18, 2004 3:23 am     Reply with quote

it is ok , thanks
hillcraft



Joined: 22 Sep 2003
Posts: 101
Location: Cape Town (South africa)

View user's profile Send private message Send e-mail Visit poster's website

PCM Programmer - please help
PostPosted: Fri Mar 31, 2006 7:29 am     Reply with quote

How do you know that the EEPROM memory is located at 0x2100

#rom 0x2100 = {0x55, 0xAA, 0x01, 0x23, 0x45, 0x67, 0x89}

I am unable to see this value in the datasheet.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Mar 31, 2006 7:49 am     Reply with quote

Go here --> http://ww1.microchip.com/downloads/en/DeviceDoc/30277d.pdf

Look at page 221, section 2.2

"The 256 data memory locations are logically mapped
starting at address 0x2100. The format for data memory
storage is one data byte per address location, LSB
aligned."

Gee Whiz! You guys should really memorize all these manuals!
JimB



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

Datasheet cryptic to the beginner
PostPosted: Fri Mar 31, 2006 10:41 am     Reply with quote

Mark,
I couldn't help but reply to the footer in your reply above. I too am always trying to obtain answers by looking at the datasheet (and the compiler manual and all the other books), however, when one is a novice, much of the information given doesn't make much sense plus many times we beginners don't know what the correct question is. It's a learning process and we are depending on you knowledgable fellows to keep steering us in the right direction.
I would love to have a narrative that goes through the data sheet explaining each of the important issues but haven't found one yet. If not for this forum I would not have made as much progress as I have.
Keep up the good work.
hillcraft



Joined: 22 Sep 2003
Posts: 101
Location: Cape Town (South africa)

View user's profile Send private message Send e-mail Visit poster's website

Mark, thank you for helping me solve my problem.
PostPosted: Fri Mar 31, 2006 11:22 am     Reply with quote

I will reserve my thoughts regarding your last comment.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Mar 31, 2006 12:29 pm     Reply with quote

It was a joke obviously! Do you really think that I would expect someone to memorize every manual?
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