LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure: To run once when the condition is true

Solved!
Go to solution

I have a case structure in my program. I am using this to count the number of cycles in my experiment. I have a feedback node (image of the program attaced here) inside a case structure. I want the case structure to run only ONCE when the condition is 'TRUE". Every 'TRUE' represents each cycle. The problem I am facing here is that the case structure is continously running as long as it is 'TRUE' instead of running once and wait for the next 'TRUE'. 

 

Temporaritly I am using a timer inside (as you can see in the image) to hold the program for the next 'TRUE' to come. I can hold like this only in case if I know exactly the time. Is it possible to make the case structure run only once when the condition become 'TRUE and wait for the next 'TRUE'?  OR is there any other loop than the case structure which do this job?

0 Kudos
Message 1 of 6
(4,682 Views)
Solution
Accepted by aneps

Hi aneps,

 

PtByPt_BooleanCrossing is your friend!

 

You really need to work on your problem analysis/description: You don't want to execute the Case as long as the input is TRUE, but you want to execute the case when the input changes from FALSE to TRUE!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(4,678 Views)

Hello! Can you please tell me how to run the counter only for once? My counter keeps counting although I set the condition. Here's the attached file please find it. All I wanted is that, when the counter detects the rising edge of the digital button it starts counting till 400 samples (only for once). The problem is that It keeps counting again and again. 

 

Thanks in advance,

Kind Regards,

0 Kudos
Message 3 of 6
(4,199 Views)

Hello! Can you please tell me how to run the counter only for once? My counter keeps counting although I set the condition. Here's the attached file please find it. All I wanted is that, when the counter detects the rising edge of the digital button it starts counting till 400 samples (only for once). The problem is that It keeps counting again and again. 

 

Thanks in advance,

Kind Regards,

Download All
0 Kudos
Message 4 of 6
(4,199 Views)

Why are not you using the examples? I saw that your code is not for edges

0 Kudos
Message 5 of 6
(4,172 Views)

You should be able to do this with some simple logic.

 

If 'Input' is true, then allow 'Count' to increment.

If 'Count' is less than (or equal) to 400 then 'Trigger' equals true.

If 'Trigger' is true then record values.

 

Just chain all of that together and you have your VI.

0 Kudos
Message 6 of 6
(4,165 Views)