LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a true boolean only once from a loop

Solved!
Go to solution

Hi everyone,

 

I'm pretty new to LabView and have been working on a project that uses it. I've run into a problem in part of my code. I have a wave form graph that is reading voltages from a DAQ card and I'm finding the rising edge of it. When the rinsing edge occurs it produces a true boolean that I pass to a case structure to trigger another event. The problem is the waveform data collection is in a while loop, because I think it has to be to keep collecting data, so it continuously sends true booleans until it is no longer on the rising edge. I want it to just send one true boolean when it hits the rising edge and then wait until it hits it again because its a sine wave.

 

I apologize that I don't have code to post right now, but any thoughts or diagrams would be much appreciated!

0 Kudos
Message 1 of 8
(5,458 Views)

This is essentially how I'm collecting my data. Except I also have some logic in the loop to find the rising edge and output a true boolean.

0 Kudos
Message 2 of 8
(5,455 Views)

Rising Edge

 

This should be made into a subvi with execution set to reentrant execution. This uses a shift register to pass the previous iteration value of the Boolean so you can detect the rising edge. The shift register is a key way of saving data in Labview.

0 Kudos
Message 3 of 8
(5,425 Views)

I'm not sure if I understand what it does, or where I should wire it

0 Kudos
Message 4 of 8
(5,418 Views)

You need to take some basic Labview Courses. This is a pretty simple cut and paste into your code. The Boolean connects to your Boolean and the rising edge connects to your case structure. Do you know how to create a subvi?

0 Kudos
Message 5 of 8
(5,412 Views)

I do know how to create a sub VI yes. So right now my current boolean for the rising edge is in the data collection while loop that I posted a scree shot of. Do I wire that boolean, inside of the data colleciton while loop, to your boolean, outside of the data collection while loop, and then just to the case structure? This gives me one true boolean output everytime the rising edge occurs?

0 Kudos
Message 6 of 8
(5,404 Views)
Solution
Accepted by topic author Hawkme

Don't reinvent the wheel.  Just use the Boolean Crossing PtByPt VI.  The output of your rising edge comparison goes into this VI and you specify "false-true" direction.  The output will only be TRUE on the first sample of your rising edge.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 8
(5,362 Views)

Thank you! That VI worked perfectly!

0 Kudos
Message 8 of 8
(5,337 Views)