12-03-2009 01:58 PM
I am still rather new to LabVIEW, so forgive me if my problem is trivial. This is what I'm trying to do:
When certain conditions are true, a motor will turn. When the stated conditions are false, the motor will turn in the opposite direction. My problem lies in how to program this with respect to certain inputs and timing.
When TRUE,
while AI0 on LabJack U12 > 2 volts, set AO0 to 4V until while condition is not true. Then set AO0 to 2.5V.
When FALSE,
while AI1 > 2 volts, set AO0 to 1V until while condition is not true. Then set AO0 to 2.5V.
The whole program should be able run at an interval, say every five minutes for example, so that the motor can respond to a change in the initial boolean.
My problem is that I am unable to have the program change AO0 to 2.5V (in the second frame of the sequence structure) in response to AI0 or AI1 > 2 not being true anymore.
For the record, I am having no issues with LabJack itself or getting readings from my instruments.
Here are screenshots of what I have:
12-03-2009 02:13 PM
12-03-2009 02:19 PM
When you press run, the constant True causes the bottom case to execute (top case never executes).
You get a reading from AI1.
If AI1 <=2.0, you send a False to the stop condition for the while loop so it runs forever setting an analog output to the same value over and over.
If AI1 > 2.0, you send a True to the stop condition for the while loop so it probably executes once, setting one of the analog outputs to 1.0 volts (I can't tell if you are wired to AO0 or AO1). The you immediately go to the next frame where you set one of the analog outputs to 2.5 volts. Then the VI is done.