Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Analog Inputs (http://www.chiefdelphi.com/forums/showthread.php?t=45390)

bush 13-03-2006 12:35

Analog Inputs
 
If we had an analog input device hooked up to Analog Input Port 1, what would the value rc_ana_in01 represent? Is it the voltage? Or possibly (Voltage * 1024 / 5)?

DjAlamose 13-03-2006 12:36

Re: Analog Inputs
 
Resistance is usally the value it looks at. I have minimal FIRST electircal experiance but normally this is whats looked at with analog.

eugenebrooks 13-03-2006 12:42

Re: Analog Inputs
 
Quote:

Originally Posted by bush
If we had an analog input device hooked up to Analog Input Port 1, what would the value rc_ana_in01 represent? Is it the voltage? Or possibly (Voltage * 1024 / 5)?

rc_ana_in01 is a constant that you pass to GetAnalogValue in order
to read the corresponding analog input.

For example:
int analogvaluefrominput01;
analogvaluefrominput01 = GetAnalogValue(rc_ana_in01);

The resulting value stored in the int variable has the range 0 to 1023
0 corresponds to roughly zero volts, and 1023 corresponds to roughly
5 volts. Your equation reflects that.

Edit: The analog inputs on the RC look at voltage. When a POT is
hooked up to one these inputs it is wired as a voltage divider for a
5 volt supply. The analog inputs on the OI have a different range,
0 to 255(254), and are set up to jump to 127 in the event that 0 volts is
applied (or the circuit opens), for safety reasons.

Eugene

The Lucas 13-03-2006 12:58

Re: Analog Inputs
 
There is an upper and lower threshold to these voltages. I don't remember exactly where they are but it is significantly different than 0 and 5V. Over the Upper Threshold you will get 1023. I think you get 0 below the Lower Threshold. Make sure you center any pots you are using so that the entire Range of Motion is in the significant voltage range.

bush 13-03-2006 13:08

Re: Analog Inputs
 
ahh thanks I understand now :)

So for example...
The dual-axis accelerometer supplied in the kit has a sensitivity of 290mV per g (acceleration due to gravity) and a range of +/- 2g. So the accelerometer reports voltages in the range of 1.92 - 3.08, and Get_Analog_Value(rc_ana_in01) would return values in the range from 393 - 631. Then I can convert that number into units of g with...

Code:

(Get_Analog_Value(rc_ana_in01) - 512) * 5.0 / 1024 / 0.290
??

Keith Watson 13-03-2006 17:49

Re: Analog Inputs
 
Quote:

Originally Posted by 2005 Full-Size Robot Controller Reference Guide
Any sensor which outputs a variable 0-5V signal may be read with 10-bit resolution on these inputs.

The correct function spelling is Get_Analog_Value() and it is defined in ifi_utilities.c


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

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