From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling timing of program

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:

 False.pngTrue.png

0 Kudos
Message 1 of 3
(2,313 Views)
Actually, I may not need help anymore. Putting the conditions that trigger the while loop in the while loop itself was a big step toward getting what I needed. Also, I changed the while loop condition to "Continue if True."
0 Kudos
Message 2 of 3
(2,303 Views)

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.

 

 

Message 3 of 3
(2,297 Views)