Go to Post there should be a continuous cascade of knowledge spilling over to the less experienced team members and and continuous upward flow of members gaining experience. - ebarker [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 06-02-2008, 14:07
M_dalgashon M_dalgashon is offline
Registered User
FRC #2230
 
Join Date: Jan 2008
Location: Israel
Posts: 3
M_dalgashon is an unknown quantity at this point
We need help with the analog inputs

Hello, I'm from team 2230, and we use potentiometers to check axis. Last year we used one potentiometer, this year we use two of them... But when we connect them both to analog inputs 1 and 2, for example, the rc only reads one of them, the one on analog input 1. We tried switching them, moving them to other pins, no use.
We have another problem, which may be connected... When we write the following piece of code:
temp = Get_Analog_Value(rc_ana_in01);
We get the following error:
M:\FRC2008\Programming\potentiometer\teleop.c:185: Error [1105] symbol 'ADC_CH0' has not been defined
To the best of my knowledge, ADC_CH0 is defined... Can someone help?

Thank you very much
Team 2230
  #2   Spotlight this post!  
Unread 06-02-2008, 15:19
JimWright949's Avatar
JimWright949 JimWright949 is offline
The Owen Day of Seattle
AKA: Jim Wright
FRC #4542 (Titanium Talons)
Team Role: Mentor
 
Join Date: Sep 2003
Rookie Year: 2003
Location: Redmond, WA
Posts: 94
JimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to behold
Re: We need help with the analog inputs

ADC_CH0 is defined in adc.h, which should be located in the compiler's directory. mcc18v2 in my case. rc_ana_in01 is defined in ifi_aliases.h which includes adc.h.

If the compiler can't find these .h files I would think that it should have given you an error saying it can't find the .h file.

From teleop.c double check that you have all the .h files included. Look at adc.h to see if there is any problems with it, and that you see ADC_CH0 is defined there.

The only other thing I can think of is check to see if you have selected the correct device. We are using the PIC18F8722. To see if you have it right, select Configure|Select Device... and you should have PIC18F8722.

-jim

Last edited by JimWright949 : 06-02-2008 at 15:21.
  #3   Spotlight this post!  
Unread 06-02-2008, 15:29
Spider-Man's Avatar
Spider-Man Spider-Man is offline
Curling Rocks
AKA: Adam Jacobson
FRC #0467 (DTB/Shrewsbury Colonials); #0034 (Rocket City Robotics)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2000
Location: Shrewsbury, MA USA
Posts: 86
Spider-Man has a spectacular aura aboutSpider-Man has a spectacular aura about
Re: We need help with the analog inputs

Actually, it appears that you are using Kevin Watson's code as your base. His code was recently updated if you want to use the old method of Get_Analog_Value, which does an analog-to-digital conversion when it is called.

Kevin's code comes with replacement code for the analog-to-digital conversion that should reduce computation and has many other benefits. If you read the readme or adc_readme file included in the zip file of the code, you should be able to set up the system and use the Get_Analog_Result function.
__________________
Student [2000 - 2001] Team 34 Rocket City Robotics
Plays Well With Others
2000 VA - Delphi "Driving Tomorrow's Technology"
2000 CMP - Top 5 Autodesk Visualization
2001 TX - Regional Finalist

Mentor [2004 - 2005][2007 - ????] Team 467 Shrewsbury Colonials (nee Duct Tape Bandits)
We Not Me
2004 LI - DaimlerChrysler Team Spirit
2004 LI - Website Design
2005 MD - Delphi "Driving Tomorrow's Technology"
2007 MA - Johnson & Johnson Sportsmanship
2008 CT - Judges' Award
2008 PA - Judges' Award

2010 MA - Judge's Award[/size][/font]
2012 DC - Chrysler Team Spirit[/size][/font]
2012 DC - Regional Winners[/size][/font]
2013 MAWO - Engineering Inspiration[/size][/font]
  #4   Spotlight this post!  
Unread 06-02-2008, 18:14
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: We need help with the analog inputs

Quote:
Originally Posted by M_dalgashon View Post
Hello, I'm from team 2230, and we use potentiometers to check axis. Last year we used one potentiometer, this year we use two of them... But when we connect them both to analog inputs 1 and 2, for example, the rc only reads one of them, the one on analog input 1. We tried switching them, moving them to other pins, no use.
We have another problem, which may be connected... When we write the following piece of code:
temp = Get_Analog_Value(rc_ana_in01);
We get the following error:
M:\FRC2008\Programming\potentiometer\teleop.c:185: Error [1105] symbol 'ADC_CH0' has not been defined
To the best of my knowledge, ADC_CH0 is defined... Can someone help?

Thank you very much
Team 2230
Sorry about the confusion I've created. The Get_Analog_Value() function has been replaced with a version that has the same functionality, but doesn't have any dependancies on external libraries or header files (other than ifi_frc.h). You can get the code here: http://kevin.org/frc/quick_adc.zip.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 08-02-2008, 17:39
aladrieth aladrieth is offline
Registered User
FRC #1482
 
Join Date: Feb 2008
Location: Calgary
Posts: 1
aladrieth is an unknown quantity at this point
Re: We need help with the analog inputs

To address the defining of ADC_CH0, which my team has been struggling to solve for the past 24 hours, you must put #include <adc.h> into the header file of ifi_frc.h. Be sure to use the <> instead of "" because that <> will call the adc.h file from the compiler, which defines ADC_CH0. The adc.h file in Kevin's code does not, and the "" will call that file instead.
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
Code to Read the Binary Inputs on Analog Buttons Kingofl337 Control System 5 14-03-2007 11:01
Help! Analog Inputs!! brennerator Programming 7 11-02-2007 15:48
Dashboard with analog and dig inputs Andrew Schreiber National Instruments LabVIEW and Data Acquisition 1 13-02-2006 22:48
Need help with Gyro = Analog Devices ADXRS150EB Jack Jones Technical Discussion 9 18-07-2005 07:00
How do the Analog Inputs work? JBotAlan Electrical 3 07-01-2005 00:11


All times are GMT -5. The time now is 08:03.

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