Go to Post I also would not recommend shipping the gerbils with the robot. - Stuart [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 29-01-2007, 23:25
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Programming Analog Input from 2004 Controller

Hey all.

This year we've finally got enough people interested in programming to have 2 subteams programming this year, and we're all stoked. One team is currently going to town on the camera and autonomous code with this year's 2007 controller, and the other team is learning how to program almost from the ground up on a 2004 controller. We don't have the old version of MPLAB or the C18 compiler to use with the 2004 controller, but the new versions of the software can compile for the old controller.

This is all fine and dandy, but we cannot find one source code package for the 2004 and/or 2005 controllers that actually compiles straight out of the box. The 2004 and 2005 default code won't compile because they're missing the adc code, and Kevin's 2005 code with adc improvements doesn't compile because it's missing a bunch of files too. We combined Kevin's 2005 adc code (just copied the adc modules, hooked in the interrupt handler, etc...) into the 2005 default code and was finally able to make a version of the code that compiles and runs. However, the values we get back from the analog inputs are really noisy, meaning if we get back a 10-bit number like "842" from an analog input, it is sometimes "84" and sometimes "8" instead of getting the full number "842". At first I thought it was a printing issue (error in flushing the buffer and such) but it's got to be a data stomping issue in the interrupt handler because the values really are getting whacked.

Is there any code out there that is "default code" that includes all of the files necessary to actually compile it (with adc modules for analog input) for the 2004 or 2005 controllers? We ran the default 2007 code with some mods on the 2007 controllers and everything works really nice and smooth, but for the life of us we cannot get anything going on the 2004 controller with any code from 2004 or 2005.

Thanks for any help you can provide!
-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
  #2   Spotlight this post!  
Unread 29-01-2007, 23:31
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: Programming Analog Input from 2004 Controller

For the 2004 RC you can take a look at:
http://www.ifirobotics.com/docs/lega...2004-02-26.zip
For the default code. To get an analog input from that:
Get_Analog_Input(rc_ana_in01);
That should give you the 10 bit analog value for what ever you have hooked up to analog input 1.
That code should compile straight out of the box (zip) with mplab 7.20 and 2.4 (i think) compiler
  #3   Spotlight this post!  
Unread 29-01-2007, 23: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: Programming Analog Input from 2004 Controller

Danny,

Have you tried the archived ADC code found here: http://www.kevin.org/frc/2005?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #4   Spotlight this post!  
Unread 29-01-2007, 23:42
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: Programming Analog Input from 2004 Controller

I just re-read you message and had a look at the 2005 ADC code. It looks like your problem is that build still uses the old non-buffered IFI serial port code. Try dropping in my serial port code and it should work just fine. If you run into problems send me your code and I'll have a look.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 30-01-2007, 00:08
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Programming Analog Input from 2004 Controller

Quote:
Originally Posted by bear24rw View Post
For the 2004 RC you can take a look at:
http://www.ifirobotics.com/docs/lega...2004-02-26.zip
... That code should compile straight out of the box (zip) with mplab 7.20 and 2.4 (i think) compiler
Nope. There are several files included in ifi_utilities.c that aren't provided, including the "adc.h" file. That's a common problem with all the default code from 2004 and 2005, they don't contain everything necessary to compile with. I'm sure somebody got it to work at some time, the way the code is written suggests it was bundled with the compiler?

-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
  #6   Spotlight this post!  
Unread 30-01-2007, 00:11
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Programming Analog Input from 2004 Controller

Quote:
Originally Posted by Kevin Watson View Post
Try dropping in my serial port code and it should work just fine. If you run into problems send me your code and I'll have a look.
We'll give that a try, thanks!

-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
  #7   Spotlight this post!  
Unread 30-01-2007, 06:51
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: Programming Analog Input from 2004 Controller

Quote:
Originally Posted by Danny Diaz View Post
Nope. There are several files included in ifi_utilities.c that aren't provided, including the "adc.h" file. That's a common problem with all the default code from 2004 and 2005, they don't contain everything necessary to compile with. I'm sure somebody got it to work at some time, the way the code is written suggests it was bundled with the compiler?

-Danny
Oh wow, I just looked and, your right they dont include a ADC file.. interesting. It always compiles fine for me i just have never used analog inputs on the 04..

Good luck
  #8   Spotlight this post!  
Unread 30-01-2007, 09:01
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: Programming Analog Input from 2004 Controller

Danny,

All files required are included in the IFI zip file. The file adc.h is a Microchip file located at C:\mcc18\h\adc.h (it has always been that way).

Also, take a look at Kevin's 2006/7 camera code. he has a readme which is called "Using_Last_Years_FRC.txt". You can use his method to alter and compile IFI's 2007 default code for the 2004/2005 controller.

Regards,

Mike
__________________
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...
  #9   Spotlight this post!  
Unread 30-01-2007, 22:44
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Programming Analog Input from 2004 Controller

Yeah, after making my last post in this thread I looked at the include directory of the c18 compiler, and sure enough it was there. The compiler options were set to look there for header files, but for some reason it didn't. Once I reset the directory by browsing to it again (I didn't *really* change the path) the compiler picked it up and we compiled Kevin's serial modification version as-is with ease. <shakes head>

We're up and running now smoothly, thanks everyone!
-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
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
FRC analog input RC filter values Gdeaver Control System 2 01-01-2006 22:03
Analog and digital input question Robby Control System 7 30-04-2005 20:07
Analog Input Trouble Matt Krass Programming 10 20-01-2005 21:09
Resistance to Analog Input Value. Josh Hambright Electrical 12 15-04-2003 16:12
DC Motor current to an Analog Input junkyarddawg Motors 43 04-04-2002 15:53


All times are GMT -5. The time now is 22:19.

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