View previous topic :: View next topic |
Author |
Message |
.C
Joined: 06 May 2004 Posts: 19 Location: Italy
|
Write_EEPROM |
Posted: Mon Jun 14, 2004 7:22 am |
|
|
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
|
|
Posted: Mon Jun 14, 2004 11:58 am |
|
|
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
|
|
Posted: Fri Jun 18, 2004 3:23 am |
|
|
it is ok , thanks |
|
|
hillcraft
Joined: 22 Sep 2003 Posts: 101 Location: Cape Town (South africa)
|
PCM Programmer - please help |
Posted: Fri Mar 31, 2006 7:29 am |
|
|
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
|
|
Posted: Fri Mar 31, 2006 7:49 am |
|
|
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
|
Datasheet cryptic to the beginner |
Posted: Fri Mar 31, 2006 10:41 am |
|
|
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)
|
Mark, thank you for helping me solve my problem. |
Posted: Fri Mar 31, 2006 11:22 am |
|
|
I will reserve my thoughts regarding your last comment. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Mar 31, 2006 12:29 pm |
|
|
It was a joke obviously! Do you really think that I would expect someone to memorize every manual? |
|
|
|