Thread: EEPROM Code
View Single Post
  #30   Spotlight this post!  
Unread 09-11-2005, 18:36
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: EEPROM Code

Quote:
Originally Posted by kc8nod
Hi Kevin,

I've got a question about EEPROM_Write().

Code:
unsigned char EEPROM_Write(unsigned int address, unsigned char data)
{
	unsigned char return_value;
 
	// return error flag if the queue is full
	if(eeprom_queue_full == FALSE)
	{
		// put the byte and its address on their respective circular queues
		eeprom_queue_data[eeprom_queue_write_index] = data;
		eeprom_queue_address[eeprom_queue_write_index] = address;
 
		// increment the queue byte count
		eeprom_queue_count++;
The parameter address is an unsigned integer, but eeprom_queue_address is an array of unsigned chars. Aren't you chopping off two bits from the address? Or did you mean to define eeprom_queue_address as an unsigned int also?
Yep, it certainly looks like a bug, an old bug. I'm not sure what happened, but the latest code isn't on the website. I'd added a EEPROM_Wipe( ) function and incorporated the change Mike Bortfeldt suggested (above), but for some reason the code never got uploaded. I guess I'll have to up the dosage on my brain fart medication <grin>. Thanks for catching this.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org