Go to Post A 823543:1 reduction should be fine if you ever need to pick up a truck...or a house. - Tim Sharp [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2011, 12:49
mutantblond mutantblond is offline
Registered User
FRC #2523
 
Join Date: Sep 2008
Location: st. johnsbury, vt
Posts: 43
mutantblond is an unknown quantity at this point
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2011, 13: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,561
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: Analog Breakout trouble-shooting

Channel 8 on slot 1 is used by the battery voltage monitoring software. You need to choose a different channel.
Reply With Quote
  #3   Spotlight this post!  
Unread 21-02-2011, 13:14
mutantblond mutantblond is offline
Registered User
FRC #2523
 
Join Date: Sep 2008
Location: st. johnsbury, vt
Posts: 43
mutantblond is an unknown quantity at this point
Re: Analog Breakout trouble-shooting

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.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2011, 13:39
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Analog Breakout trouble-shooting

Quote:
Originally Posted by mutantblond View Post
If I use AnalogChannel(1), and plug the PWM into the pins closest to the PD supply connector, I get the same result.
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2011, 14:20
mutantblond mutantblond is offline
Registered User
FRC #2523
 
Join Date: Sep 2008
Location: st. johnsbury, vt
Posts: 43
mutantblond is an unknown quantity at this point
Re: Analog Breakout trouble-shooting

where are the allocated channels listed? does just the gyro and the battery voltage have allocated channels? Gyro is channel 1
Reply With Quote
  #6   Spotlight this post!  
Unread 21-02-2011, 14:35
mutantblond mutantblond is offline
Registered User
FRC #2523
 
Join Date: Sep 2008
Location: st. johnsbury, vt
Posts: 43
mutantblond is an unknown quantity at this point
Re: Analog Breakout trouble-shooting

Alan,
thank you! 10 hours + later....
now onto the pot
Reply With Quote
  #7   Spotlight this post!  
Unread 21-02-2011, 14:36
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Analog Breakout trouble-shooting

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.

Quote:
Originally Posted by mutantblond View Post
thank you! 10 hours + later....
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.
Reply With Quote
Reply


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


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

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