Analog Breakout trouble-shooting

Wasn’t sure whether to post this in the Sensors forum or here…
I am trouble-shooting our analog breakout board to use it with a pot.
At this point, i’m just trying to read the input signal from the board, using printf statements and looking at the Analog Input lights on the I/O screen of the Driver Station. I have the PWM wired with 5V and ground on the middle pin and pin closest to the board, respectively, and a DC signal to the inside pin. The pertinent code looks like the following:

elbow = new Analogchannel(8); //PWM is connect to the pin closest to the jumpers - the outside 2 pins are jumpered
DriverStationLCD *dsLCD = DriverStationLCD::GetInstance();

while(1)
{
voltage = elbow->GetValue();
dsLCD->Printf(DriverStationLCD::kUser_Line1, 1,“Voltage is %d”,voltage);
dsLCD->UpdateLCD);
Wait(1.0);
}

A few things are happening -

  1. the print out is giving me values of 1441 -ish (was 0 last night), and they don’t change if I vary the input voltage.
  2. I don’t see any signal on the Analog Input indicators in the I/O window
  3. I’m gett the following Message in the Diagnostics window:
    Fatal error"Attempting to reuse an allocated resource" in Allocate() in C:/windriver/workspace/WPLib/Resource.cpp at line 76
    Modifed Network Configuration: Set The object already exists.

I/O unit not detected or not installed correctly.

We are currently running in Autonomous mode.
The analog board is connected to the 9201 which is in slot 1 of the CRIO.

I’ve been working on this for hours, with no luck.
any help is appreciated.

Channel 8 on slot 1 is used by the battery voltage monitoring software. You need to choose a different channel.

If I use AnalogChannel(1), and plug the PWM into the pins closest to the PD supply connector, I get the same result.
I’ve checked that the PWM cable is ok - the PWM inputs into the AB board are what they should be.
The other thing that happens that’s kinda strange is when I disable the 'bot, the While loop keeps going - I actually have a counter in that loop that prints out at the same time as the Voltage is being printed out.

Does that include the “Attempting to reuse an allocated resource” error message? Look to see what else might be configured to use Analog Input 1 (the gyro, for example). You might need to choose Channel 7, for example.

where are the allocated channels listed? does just the gyro and the battery voltage have allocated channels? Gyro is channel 1

Alan,
thank you! 10 hours + later…
now onto the pot

Channel 8 is pre-assigned to the battery voltage monitoring. Other than that, only the analog channels your program actually opens will be allocated. So the answer is that they are listed in your source code.

It looks like it was just your bad luck to choose the two channels that already had things connected to them. The error message is pretty specific, though.