|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
DriverStation::GetAnalogIn - what range?
From the C++ reference manual:
DriverStation::GetAnalogIn returns the analog voltage on the input. The analog values are returned as UINT32 values.... Let's keep it simple, ignoring noise: 1) when an analog input is at ground, what value is returned? 2) when an analog input is at +5V, what value is returned? |
|
#2
|
||||
|
||||
|
Re: DriverStation::GetAnalogIn - what range?
The Driver Station has a 10 bit ADC. This means that the possible range of values is from 0 to (2^10)-1, or 0 to 1023.
I just looked at the source code for the DriverStation, and I'm actually a little confused about it. FRCComm.h describes the analog inputs like this: Code:
struct FRCControlData{
...
//Analog inputs are 10 bit right-justified
UINT16 analog1;
UINT16 analog2;
UINT16 analog3;
UINT16 analog4;
...
Code:
/**
* Get an analog voltage from the Driver Station.
* The analog values are returned as UINT32 values for the Driver Station analog inputs.
* These inputs are typically used for advanced operator interfaces consisting of potentiometers
* or resistor networks representing values on a rotary switch.
*
* @param channel The analog input channel on the driver station to read from. Valid range is 1 - 4.
* @return The analog voltage on the input.
*/
float DriverStation::GetAnalogIn(UINT32 channel)
{
wpi_assert ((channel >= 1) && (channel <= 4));
GetData();
switch (channel)
{
case 1:
return m_controlData->analog1;
case 2:
return m_controlData->analog2;
case 3:
return m_controlData->analog3;
case 4:
return m_controlData->analog4;
}
return 0;
}
The @return comment implies that it returns the actual voltage on the analog port -- but how does it do this? It doesn't look right to me, and could be an oversight by the WPI Library developers. If it's not, perhaps someone else could help explain this... |
|
#3
|
||||
|
||||
|
Re: DriverStation::GetAnalogIn - what range?
For reference, I've posted about this on the official FRC Control System forum here:
http://forums.usfirst.org/showthread.php?t=12254 |
|
#4
|
||||
|
||||
|
Re: DriverStation::GetAnalogIn - what range?
Quote:
1023 We are using these with version WPILib 3.0, and have tested and used on our production bot. Not that this is the intended behavior, but that is what it returns. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| question regarding driverstation | ringo115 | Programming | 4 | 16-02-2009 11:16 |
| driverstation outputs | agough | C/C++ | 3 | 15-02-2009 22:25 |
| Wiring LED to Driverstation | sircedric4 | Electrical | 11 | 23-01-2009 08:31 |
| Writing to DriverStation cRio screen | alexjplant | NI LabVIEW | 2 | 17-01-2009 10:59 |
| Finding range | DanDon | Programming | 11 | 10-01-2006 22:58 |