03-31-2009 02:29 PM
I want to control the flow of data, by a SWITCH.
I have a data flow which I want it to flow through a particular code, when I press that SWITCH, the data flow should be blocked and the code should use the previous values stored to calulate further.
Is there any such switch available in LabVIEW, so control the flow.
Thank You
03-31-2009 02:34 PM
It sounds like you want to use a case structure which is one of the fundamental structures in LabVIEW.
I would recommend you learn more about LabVIEW from here. How to Learn LV
03-31-2009 02:40 PM
Like Ravens said, you'll definitely want to use a case structure. You will also want to use another widely used function in LabVIEW: shift registers. This is what will "store" your data from previous iterations.
I made a quick little VI to show you what we mean:
You will notice when the switch is pressed, you will see the iteration count go up, when it is false, the iteration count will stay the same, until the user hits the switch again.
03-31-2009 02:43 PM
There is also the "Select" operator in the comparisons pallette. I really like that one because it makes for a cleaner looking diagram, but one must always keep in mind that the Select operator will perform both operations leading to the "t" and "f" terminals where as the case structor is better at only executing necessary code.
As Ravans Fan pointed out, you would probably learn more faster by going through the LabVIEW tutorials. Case Structures and Select operators are fundamental to LabVIEW and are covered in the tutorials.
03-31-2009 03:15 PM
Thank You all for the replies
I have tried CASE structure, but what I am trying to do, I am not able to do it using using CASE.
Let me explain again.
I an sending continous data to a part of the code. What I need to do is make something (Switch/Button), that when I press the button, it should hold the value at that time and then continue the calculation with of the code with that stored value.
When I use case, When the condition is true it sends the value, but then when I make it false it does not stop and hold the value.
I hope I have explained it properly.
Thank You.
03-31-2009 03:19 PM
It's just a matter of using the case structure properly with the shift registers.
It would be easiest if you post what you have so far as a .vi so that we can see where you may be going wrong.
03-31-2009 03:34 PM
Did you look at the example I attached for you?
It counts the iterations, when you hit the "switch" again, it will keep the same value. (you can do calculations off of this value then) After you are done, hitting the switch again will go back to increasing the iteration count.
03-31-2009 03:40 PM
03-31-2009 03:42 PM
Ahh, my fault. Here you go: