View Single Post
  #3   Spotlight this post!  
Unread 16-03-2004, 17:31
DKolberg DKolberg is offline
Mentor Iron Giants
AKA: David Kolberg
FRC #5069 (Iron Giants)
Team Role: Mentor
 
Join Date: May 2002
Rookie Year: 2000
Location: South Bend
Posts: 44
DKolberg has a spectacular aura aboutDKolberg has a spectacular aura about
Re: Problem with reading and writing EEPROM

Quote:
Originally Posted by Random Dude
Hmm..

First off, for anyone who missed the original discussion on EEPROM, I suggest you go check that out.

That being said, 0xFF is the inital value of the EEPROM unless data is written to it. So your problem is with your write function.

Could you post your function calls to the EEPROM library?
I have tried writing the following in the User_Initialization routing:

EEADR = 1;
EEADRH = 0;
EEDATA = 5;

EECON1bits.EEPGD = 0;
EECON1bits.CFGS = 0;
EECON1bits.WREN = 0;
INTCONbits.GIE = 0;
EECON2 = 0x55;
EECON2 = 0xAA;
EECON1bits.WR = 1;
INTCONbits.GIE = 1;
EECON1bits.WREN = 0;

downloaded and ran once then changed to the following:

EEADR = 1;
EEADRH = 0;

EECON1bits.EEPGD = 0;
EECON1bits.CFGS = 0;
EECON1bits.RD = 1;

printf("eeprom read address high %d, low %d, value %d\n",
(int) EEADRH, (int) EEADR, (int) EEDATA);

and the value printed is 255

Dave