06-11-2015 03:04 PM
Hi. I am modifying a LabVIEW program that takes an analog voltage input and graphs the voltage then detects if there are peaks when a digital input signal is active. I am trying to adjust the program to set a digital output to true if a peak on the analog voltage input is not detected while the digital input (run) is on (similar to an error light), but since I just started using LabView, I can't figure out the case and while statements. I would really appreciate some help.
Thanks!
06-11-2015 04:38 PM
CASE executes one (and only one) of the encased diagrams, based on the value of a selector (the ? symbol) when it's executed.
A WHILE loop repeats everything within the loop, as long as the CONDITIONAL terminal is set TRUE (repeat while true) or FALSE (stop if true). You choose which way you want the conditional terminal to act.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
06-12-2015 09:44 AM
Thanks!
I think I understand how the case and while structures work, I just don't know how to use them together if a boolean input (2) doesn't go to true while a different boolean input (1) is true, then set an output to ture if this occurs. I think I need to put a case inside a while loop so that the while loop will only run when input 1 is true then the case will continuously check input 2 to see when or if it changes to true, however when my while loop runs, it freezes the rest of the program and I can't use two inputs to the while and case statements.
06-12-2015 10:03 AM
when my while loop runs, it freezes the rest of the program
--- Keep in mind a simple rule:
1... A node will not run until ALL its inputs are available, and will not stop until ALL its innards have executed.
That applies to a WHILE loop just as much as it does to an ADD function.
and I can't use two inputs to the while and case statements.
You can't use an input to the WHILE, while the WHILE is running? See rule 1.
Remember that a wire going thru a "wall" into a WHILE (or FOR) loop, is sampled ONCE when the loop starts. No matter what happens on that wire, it will not affect what the loop innards see on that wire.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
06-12-2015 10:08 AM
the case will continuously check input 2
CASE structures do not "continuously check" anything.
A CASE asks a single question, one time: "What is the value of my selector?"
Based on the answer to that one question, it will execute one or another of its available diagrams.
If you want to do it again, then you have to have the CASE be inside a loop of some type.
Blog for (mostly LabVIEW) programmers: Tips And Tricks