Go to Post Are you asking if I can pick up electrons? I'm positive. - Gary Dillard [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #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?
  #2   Spotlight this post!  
Unread 26-01-2005, 20:55
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: EEPROM Problems

Brian,

Please read carefully through this thead: http://www.chiefdelphi.com/forums/sh...ad.php?t=22655 and pay particular attention to the details of timing, et cetera.

In answer to your question, yes, EEPROM data will be available to you for many years to come (if you store it correctly).

Please post again if there is still a question...
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 27-01-2005, 00:01
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: EEPROM Problems

Quote:
Originally Posted by Mike Betts
In answer to your question, yes, EEPROM data will be available to you for many years to come (if you store it correctly).
Doesn't EEPROM data get wiped out when you download a new program? (This was part of his question too.)
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #4   Spotlight this post!  
Unread 27-01-2005, 01:02
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: EEPROM Problems

Quote:
Originally Posted by gwross
Doesn't EEPROM data get wiped out when you download a new program? (This was part of his question too.)
Greg,

Actually, I'm not sure. I have not thought about it or researched it but flash and eeprom should have different bootstrap requirements and, therefore, separate erase routines... Flash is erased as a block and, as I remember, eeprom is erased byte by byte.

Maybe someone out there has actually done this?

I'll look in the documentation this weekend (I'm a bit busy right now). However, it is an interesting question...
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #5   Spotlight this post!  
Unread 27-01-2005, 01:22
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: EEPROM Problems

OK, I couldn't help myself,

From PIC18F6520/8520/6620/8620/6720/8720 Data Sheet, section 4.0, page 41:

Quote:

There are three memory blocks in PIC18FXX20 devices. They are:
• Program Memory
• Data RAM
• Data EEPROM
Data and program memory use separate busses, which allows for concurrent access of these blocks.
Since the data and program busses are independent, I would guess that reprogram with the IFI loader will not affect data EEPROM.

JMHO.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #6   Spotlight this post!  
Unread 27-01-2005, 09:30
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: EEPROM Problems

Quote:
Originally Posted by Mike Betts
Maybe someone out there has actually done this?
We did this last year for calibration values of the pots on our arms & crab wheels. We had a calibration mode that would read pot values at certain positions (in the case of crab it was center, full left, and full right) and store them off in EEPROM. Whenever the controller started up we would read those values from EEPROM and store them in a local calibration values structure so they were available to the crab/arm control routines as limit points.

This library of code was a huge time saver for the SW team because the procedure for calibrating a pot changed from: download debug code to read pot values, move crab/arm to endpoints & read values, change endpoint constants in header file, download code with new constants; to: put robot in calibrate mode and tap a button when crab/arm is at each endpoint, reset. It meant the pit crew could swap out a broken pot and calibrate it without a SW team member there. Best piece of SW we wrote in my opinion.

I also recommend adding a joystick calibration mode that prints the raw joystick values on the OI display. It saved our team when we needed to swap out a broken joystick while in line for our match. The drivers were able to center the stick without special debug software.

If there's interest & I get some time I'll write up a more detailed post explaining how we did all this.
  #7   Spotlight this post!  
Unread 27-01-2005, 10:03
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: EEPROM Problems

Quote:
Originally Posted by Mike Soukup
We did this last year for calibration values of the pots on our arms & crab wheels...
Mike,

Thank you... To answer Greg's question, is EEPROM erased when you download a new program via the IFI Loader?

Regards,
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #8   Spotlight this post!  
Unread 27-01-2005, 10:14
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: EEPROM Problems

Quote:
Originally Posted by Mike Betts
To answer Greg's question, is EEPROM erased when you download a new program via the IFI Loader?
Oops, I guess I never answered that. I spent too much time babbling and forgot the original question.

EEPROM is not erased when you download a new program, I'll verify this tonight.
  #9   Spotlight this post!  
Unread 27-01-2005, 15:07
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
Re: EEPROM Problems

Quote:
Originally Posted by Mike Soukup
We did this last year for calibration values of the pots on our arms & crab wheels. We had a calibration mode that would read pot values at certain positions (in the case of crab it was center, full left, and full right) and store them off in EEPROM. Whenever the controller started up we would read those values from EEPROM and store them in a local calibration values structure so they were available to the crab/arm control routines as limit points.

This library of code was a huge time saver for the SW team because the procedure for calibrating a pot changed from: download debug code to read pot values, move crab/arm to endpoints & read values, change endpoint constants in header file, download code with new constants; to: put robot in calibrate mode and tap a button when crab/arm is at each endpoint, reset. It meant the pit crew could swap out a broken pot and calibrate it without a SW team member there. Best piece of SW we wrote in my opinion.

I also recommend adding a joystick calibration mode that prints the raw joystick values on the OI display. It saved our team when we needed to swap out a broken joystick while in line for our match. The drivers were able to center the stick without special debug software.

If there's interest & I get some time I'll write up a more detailed post explaining how we did all this.
I'm using it for something very similar to the joystick stuff. It detects the joystick center and its maximum possible range, and calculates deadbands off that. When I get it working correctly I can post it. I found an improved version of the eeprom code later in that thread, and I'll try that out tonight. Thanks for the help.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
read/write EEPROM on 18F8520 WizardOfAz Programming 39 22-03-2004 13:32
Problem with reading and writing EEPROM DKolberg Programming 4 16-03-2004 19:29
Do you all have problems with.... Munkaboo Website Design/Showcase 19 03-03-2003 19:51
Joystick problems archiver 2001 3 24-06-2002 02:40


All times are GMT -5. The time now is 01:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi