11-17-2016 10:12 AM
Hello
So i need to create a program where if a condition were true, then the program inside the case structure run but only once, and won't run again until the condition were false and true again.
For example the condition is x>20, and the program inside the case structure is y=y+1, when the x value are set to be 23, the y value is now 1, and it wont increase eventhough x value are still 23 or change to any number greater than 20, but when it is drop to 15, and up again to 34, the y value is now 2.
I dont know how to make the program inside the case structure run only once, so any help is appreciated.
Solved! Go to Solution.
11-17-2016 10:27 AM
Lookup the Boolean Crossing PtByPt.vi. It is buried in the Signal Processing->Point By Point->Other Functions PtByPt palette. That VI detects when a Boolean value has changed. You can set it up to only output a TRUE when the input changes from a FALSE to a TRUE. So just put this in line with your current case structure logic so that the case structure only runs when the logic changes from FALSE to TRUE.
11-17-2016 10:47 AM
Use shift registers or feedback nodes to remember the last comparison result. Perform code only if the current comparison is True and the last comparison is False.
04-01-2023 02:15 AM
Thank you