LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set output to true if peak is not detected while run is true

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!

0 Kudos
Message 1 of 5
(3,511 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 5
(3,482 Views)

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.

0 Kudos
Message 3 of 5
(3,450 Views)

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.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 5
(3,444 Views)

 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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 5
(3,439 Views)