![]() |
DIO not working in autonomous.
We are trying to do something that should be very simple. We are trying to read a switch hooked up to module 4, channel 1, and based on its value turn on an LED connected to module 4 channel 6.
The switch is wired from signal to ground so that an open switch should return "True" and closed should return "False". By using a multi-meter, I have verified that the signal line switches between 4 volts and ground with the switch open, then closed. The LED is wired from the +5v line to signal, so that the signal pin provides the ground for the LED. I verified that the LED works by connecting it between +5v and Gnd lines on the digital breakout board. This is all basic stuff we did on last years controller successfully. The problem is that the Labview program doesn't see the switch signal pin changing at all, and the signal line connected to the LED never changes from 4.0v. The code for the autonomous portion is included below. Someone please tell me what simple thing we have overlooked. I know I am going to feel stupid when I see the answer, but we have stared at this for 2 days now without seeing what is wrong. We know it is running the autonomous code as the numeric indicator increments as expected. Neither the boolean indicator or the LED ever changes state. ![]() Thanks, |
Re: DIO not working in autonomous.
do you know for sure that the switch is working correctly and switching the input the way you want? if so, next time you run the program, open the VI that its in and click on the light bulb in the block diagram. this will allow you to see the values that are being read and sent. [light bulb is highlighted in attached picture] the only other thing i can think of asking is if the LED has/needs a resistor? 330 ohm should do the trick if so. i know the driverstation will reset itself if one of the 5v source pins touches the 0v ground pins, so watch out for that. if all else fails reload the code.
burmeister.twosevennine@gmail.com |
Re: DIO not working in autonomous.
Yep, we clicked the light bulb and the output from the DIO-Get call never changed from "T" regardless of whether or not the switch was pressed. At the same time we put a multi-meter on the signal line connected to the switch and watched it change from 4.0v (switch open) to 0v (switch closed). I'm positive the switch and signal line are doing what they are supposed to, but the program isn't seeing the change on the signal line.
|
Re: DIO not working in autonomous.
P.S. The LED does have the required inline resistor.
|
Re: DIO not working in autonomous.
I can't say what is wrong, but I may be able to tell you how to debug it.
Use either execution hilighting to watch the values flow through the wires, or use the dashboard to see if there are errors coming from the code.Some of the I/O is picky that multiple places in the code don't each open and talk to it. My guess is that the debugging will show you which is getting the error. Greg McKaskle |
Re: DIO not working in autonomous.
You don't mention a pullup resistor on the digital input. You didn't need one last year. Even though your test inicates it's working I would add the pullup.
However, based on your tests, I'd be concerned about using the correct input channel. I'd try switching input channels while leaving the wires in place to see if you have the wrong input. Could be a 1-0 numbering problem. Also, try switching the led from a screen button, switch ALL the outputs. |
Re: DIO not working in autonomous.
Greg,
We did use the execution highlighting and did not see any errors (a previous version of the code passed the error signal through so we could look at it). Phil, If you look at the datasheets, the GPIO lines have a 10K pullup resistor. I did verify with a multi-meter that this was the case and that closing and opening the switch made the voltage at the signal line do what we expected. I also verified that NONE of the signal lines (set as outputs) changed output voltage when expected, so I don't think we have a numbering issue. We also at one point added a switch to our Labview control panel and connected it to the LED and on-screen LED indicator. The on-screen indicator turned on and off just like expected, but the voltage didn't change on any of the GPIO signal lines. Thanks all for the great suggestions. I know there must be one of those "Duh" things that we are doing wrong somewhere, but I sure can't see it yet. Thanks, |
Re: DIO not working in autonomous.
Quote:
|
Re: DIO not working in autonomous.
PROBLEM SOLVED!
As expected it was a hardware problem: Loose nut behind the keyboard (me). It was an indexing issue (0 vs. 1). We had the switch connected to DIO ch 1 (according to the numbers on the digital breakout board) whereas the code needs to use 0 to access that channel. Why couldn't they have numbered the breakout board starting at 0? I could have SWORN that we had run a test to check for this yesterday, but apparently not. I was 99.9% certain it had to be a programmer problem and (sheepish grin) I once again proved myself right. Thanks for all the suggestions. :) |
Re: DIO not working in autonomous.
From your picture, the red dots at the inputs of your opens is the clue. Those are coercion dots, which means the data types didn't match, but LabVIEW took its best guess.
Those expect an enumerated type, but you wired them to a integer constant. The best way to get the enumerated type is the right click on the input and choose create constant. From there you can use the drop down menu to select which one you want (for example, DIO 1). When you do it that way, the numbering on the hardware and in LabVIEW match. |
Re: DIO not working in autonomous.
Joe,
Thanks for the suggestion. This is yet another of those items where Labview will help you out, but we didn't know that it would or how to do it. |
| All times are GMT -5. The time now is 08:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi