03-17-2009 12:37 PM
hi
i am using a case structure inside a while loop.
i want to put a delay of about one second whenever the case goes false (it should remain false untill 1 second) and then comes to normal routine. i tried to use the function wait(ms) but then it effects the while loop. is there any way to put a delay without effecting the the normal timing of the while loop operation?
i am attaching a simple example vi to clear my point.
thanks
Solved! Go to Solution.
03-17-2009 12:55 PM
Of course it will, the case can't finish until the wait is up. And the iteration of the while loop can't finish until the case structure is done.
What do you want to have happen in the while loop while the case structure is waiting for a second?
You have two choices. One is to separate the two pieces of code into two while loops
The other is that you use an Elasped Time timer (an express VI, that doesn't slow down the loop, but only executes the true case in the event the time has elapsed and whatever other condition you want to make the true case true. It isn't a delay, just a check whether a certain amount of time as passed.
03-17-2009 01:47 PM
you are right but i want to make the false statment to stay for one second even the case is true,
or may be my approach is wrong, let me explain u in this way, suppose considering the attached example if i want to skip a complete cycle from the chart shown in case statment what i thought this can be done only when the false statment appears and stay for little longer., what i am thinking is to put some kind of delay in false statment to make it false for a while even after case statment set to true, do you have any other approach to acheive this kind of result, but offcourse i prefer to use single loop.
thanks for the reply
03-17-2009 01:58 PM
You might want to consider using a boolean and a shift register for that boolean to control the case structure selection. This way you can make a smaller delay that does not affect the operation of your while loop, and keep that boolean false for some number of iterations of the while loop until a second has passed. After that, you can have a condition to set the boolean in the while loop back to true, or whatever you want.
You might want to consider using a timed while loop as well.
03-17-2009 02:04 PM
can u please show me how could i do this in some picture or on the same vi i posted earlier.
thanks for the suggestion
03-17-2009 02:14 PM
03-18-2009 07:25 AM