We have been trying to set and reset the digital outputs on the cRio drivers station and have had very erratic results. We can do it in a simple vi but when we try to use it in our competition program, the output is unpredictable. Anyone know if there is an overseeing part of the program that we have to use to actually write valid information to the digital outputs?
Thanks in advance.
Is there any chance it has something to do with the program running at a different rate?
The driver station only sends/receives data every 20ms.
(Alternately it could be due to a Front Panel control resetting to its default value)
I had misunderstood you, and thought it was running correctly in a temporary deployment, but not as a run-time startup. Execution rate may still be the problem, but in this case it would be that it’s running too slow. I don’t know whether the DS resets a digital output if it doesn’t get a reply soon enough. Considering it’s UDP, it’s unlikely, but the best place for this code is in “periodic tasks” nonetheless (with a 20ms ‘wait’ function).
If you are using shift registers make sure there isn’t a break in the lines at all, that’d be bad =)
Thanks for the suggestions. We found the problem(s)… The help definition of set digital output for the drivers station doesn’t mention that you need to input using an array or you get conflicts because the unaddressed outputs are reset.
Additionally using the AND function with numbers returns the anded number. Even though it is a non zero, it will not correctly trigger TRUE for an IF statement. You have to use a “greater than zero” before feeding into the IF statement to get a proper decision from the statement.
This may be documented somewhere but I missed it. Anyway, that was the problem.
Hey Mr. Alaniz
Figured I should make an account eventually.
To clarify, The problem was we were attempting to set the digital outputs on the driver station in 4 places within the same while loop. Our outputs on the front panel were flickering all over the place, and as I was working on it I realized we were writing 4 different arrays at the same time.
So In Summary, Use only one Set Digital Output per loop and control the Outputs (Hi/Lo) by building an array with 8 boolean elements.
An additional Note: While the Driver Station and almost everywhere else say Digital Output 1-8, for Array purposes 1 is 0 (So not 1-8, 0-7)
Maybe everyone here already knew that but that was news to me after working on it for a couple hours of head scratching