Thread: EEPROM Problems
View Single Post
  #1   Spotlight this post!  
Unread 26-01-2005, 20:09
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
EEPROM Problems

Or maybe its I don't know what to expect. Will EEPROM remain throughout program downloads? I'm hoping it does through controller resets.. but it doesnt seem to be.

I've got this code, that I got from somewhere on these forums
Code:
	char readEE(unsigned short address) {
		EEADRH = ((address>>8)&0x03);
		EEADR = (address&0xFF);

		EECON1bits.EEPGD = 0;
		EECON1bits.CFGS = 0;
		EECON1bits.RD = 1;
	
		return EEDATA;
	}
	char writeEE(unsigned short address, char data) {
		EEADRH = ((address>>8)&0x03);
		EEADR = (address&0xFF);
		EEDATA = data;

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

I have funtions that should be reading and writing to functions.. but the data doesn't seem to be staying though controller resets and program downloads. Any help?