Go to Post For all of you thinking three alliances... how big of a pain would it be to have three different bumper colors? - Jon Stratis [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 01-02-2008, 14:33
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
RC Analog

Need help. Does anyone know how to call the RC analogs. Is it the same as digitals. We are using IR sensors and want to use the RC analog ports. The digital call is rc_dig_in01. What is the call for analog? Thanks.
  #2   Spotlight this post!  
Unread 01-02-2008, 15:02
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: RC Analog

look in ifi_aliases.h for the one you want to use. Then use the "Get_Analog_Value" function to retrieve the value.

Last edited by tdlrali : 01-02-2008 at 15:04.
  #3   Spotlight this post!  
Unread 01-02-2008, 15:05
JonathanLKS JonathanLKS is offline
Code::Blocks
FRC #0610 (The Coyotes)
Team Role: Leadership
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Toronto
Posts: 36
JonathanLKS will become famous soon enough
Send a message via MSN to JonathanLKS
Re: RC Analog

The call for analogs are
rc_ana_inXX

be careful though, you can't directly read these, you need to run them through the Analog to Digital Converter. If your using the default code it would be called like this
Code:
Get_Analog_Value(rc_ana_in01);
Make sure you set the proper number of analog channels to use though in user_routines.c
__________________

Team 610 [ Co-Leader | Head Programmer | Webmaster ]
We're attending: Greater Toronto Regional, San Diego Regional, Championship
  #4   Spotlight this post!  
Unread 01-02-2008, 15:43
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: RC Analog

Thanks. I'm using the new code from Kevin. When I put
Get_Analog_Value(rc_ana_in01); in my code I get errors. Can you show me a small loop to achieve this. Thanks again.
  #5   Spotlight this post!  
Unread 01-02-2008, 16:06
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: RC Analog

Quote:
Originally Posted by Slick View Post
Thanks. I'm using the new code from Kevin. When I put
Get_Analog_Value(rc_ana_in01); in my code I get errors. Can you show me a small loop to achieve this. Thanks again.
Kevin's code uses a different method. Use Get_ADC_Result instead and make sure to choose the right options in adc.h.
  #6   Spotlight this post!  
Unread 01-02-2008, 18:17
JonathanLKS JonathanLKS is offline
Code::Blocks
FRC #0610 (The Coyotes)
Team Role: Leadership
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Toronto
Posts: 36
JonathanLKS will become famous soon enough
Send a message via MSN to JonathanLKS
Re: RC Analog

It's also important to note that Get_ADC_Result uses just the number (1, 2, 3 etc...) not rc_ana_inXX

So instead of
Code:
Get_Analog_Value(rc_ana_in01);
you'd write
Code:
Get_ADC_Result(1);
You'll also need to enable the ADC in teleop.c and enable the ADC timer in ifi_frc.h
__________________

Team 610 [ Co-Leader | Head Programmer | Webmaster ]
We're attending: Greater Toronto Regional, San Diego Regional, Championship

Last edited by JonathanLKS : 01-02-2008 at 18:18. Reason: typo
  #7   Spotlight this post!  
Unread 02-02-2008, 11:27
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: RC Analog

Tried the Get_ADC_Result(1); and it does not compile. Went to the old code and used Get_Analog_Value(rc_ana_in01); and it does compile. I'm using the printf to see my value: example: printf ("Analog 1 = %i \r\n"' rc_ana_in01); and I'm not getting any readings from my IR sensors. I fell very confident the sensors are working correctly and I have it plugged to the Analog one port on the RC. What am I doing wrong??? How can I get the analog reading? Thanks for all of the help so far and I feel close to solving this problem.
  #8   Spotlight this post!  
Unread 02-02-2008, 12:10
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,171
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: RC Analog

We use the following lines to read an ultrasonic sensor...

uProximityRaw = Get_ADC_Result(RHS_PROXIMITY_LEFT);
uProximityMv = Convert_ADC_to_mV(uProximityRaw);

... and it absolutely works. So you must not have Kevin's ADC stuff set up correctly. If this does not compile, make sure that adc.c is in your project, follow the directions in adc.h for configuration and make sure to put the following line in all source files where you call Get_ADC_Result(x).

#include "adc.h"

HTH
  #9   Spotlight this post!  
Unread 02-02-2008, 12:26
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: RC Analog

That was it.. Thanks to all. You guys are "THE MAN"...
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
aux analog guy_rom Technical Discussion 4 01-01-2008 23:54
Digital to OI Analog marcan Control System 33 05-02-2007 12:46
Analog Inputs bush Programming 5 13-03-2006 17:49
Analog in on OI: Heads Up! Astronouth7303 Programming 5 05-02-2004 17:55
Analog Inputs 316_programer Technical Discussion 2 05-02-2002 05:53


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

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