LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

turn on a case structure with rising edge trigger

Dear all,

I need to use the first rising edge of a gate pulse to switch on a case structure,and then ignore the values occurring after this rising edge until the next iteration of the loop in which the case structure (and the rising edge trigger detection code) are contained. 

I am trying to adapt the attached code (which I use for a similar operation) but I cannot figure out why it is not doing what I am expecting it do to... (the top boolean tunnel to the right of the while loop is the one I would use to switch to true the case structure)

suggestions most welcome!

 

g_bress_0-1654878471211.png

 

0 Kudos
Message 1 of 23
(3,350 Views)

We prefer actual VIs over truncated code picture. We cannot see what's in the other case, we cannot see what's outside the visible area, etc. Where is the toplevel loop? Why all these coercion dots? What does your ms timer display actually tell you?

0 Kudos
Message 2 of 23
(3,347 Views)

Not sure what your data looks like and just guessing from the image you attached.

For Loop.png

I think something like this would be more apt. (A For Loop). You can use "Wire Probes", "Highlighted Execution", "Stepping" to start debugging and finding answers to your Whys. See which step of your logic is not working as needed.

 

I believe something like this may also work for you.

From my understanding.png

This is not a solution to your problem but just an idea to look at your image file from a different perspective.

 

Message 3 of 23
(3,315 Views)

dear altenbach, the other case is empty, the case selector was wired to a true constant for testing purposes and never got rid of it...

The conditioning bits are used to tell if the rising edge occurs within the 1st or 2nd ms after the whole thing is turned on.

0 Kudos
Message 4 of 23
(3,274 Views)

The first solution provided by xonmyth743 does what I need. the issue I am facing now is that I need this code to reset, but once the first rising edge has been found, the next iterations will keep the output state locked to "true"! I guess I need to bring the boolean back to false at the end of the last iteration of the conditional for loop, tired a few things but none worked...

0 Kudos
Message 5 of 23
(3,243 Views)

Can you post the most recent code for version 2019?

0 Kudos
Message 6 of 23
(3,232 Views)

I only have labview 2013, here is the code anyway. I think the boolean is switching now, but I am not sure the way I am doing it is the best

Download All
0 Kudos
Message 7 of 23
(3,217 Views)

Attached VIs work as you mentioned. Value property node is not needed.

Download All
Message 8 of 23
(3,203 Views)

Here's another method. Note your method cannot handle fast switching, ie, more than one transition in stream. Have not tested extensively, please check. 2013 Version attached.

Snap12.png

 

Message 9 of 23
(3,198 Views)

hi all, so my testing vi works fine but when I set it to trigger on the rising edge of the actual gate signal (which lasts >30 ms, 5.5 V amplitude and arrives at a "random" time, but hundreds of ms after the rising edge detection .vi has started to run) it behaves erratically, as in:

-sometimes it looks like it is doing what it should do;

-sometimes it detects the rising edge of a gate pulse different from the first one (I have a train of 30 gates but I want to ignore all but the first one);

-sometimes it does not detect any trigger. 

It is worth mentioning that the .vi in my code is placed inside a timed sequence, whose start is delayed by 500 ms from another timed sequence (which contains the gate pulses source), both are synced to the same (software) 1khz clock which resets at each iteration. Could that be the cause of the unreliability of the code?

 

Something I should have mentioned earlier is that I need to find my rising edge with sub-ms precision, as in since the rising edge is found I need to set the input value of the case structure selctor to "true" as fast as possible to record data at 1 kHz, without missing the first events!

0 Kudos
Message 10 of 23
(3,154 Views)