LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

chosing frames to run

I have an LV which has frames 0,1,2,3,4 & 5. Sometimes I want to run frames 0,1 & 3. Other times I want to run frames 0, 1 , 4 & 5. How do do that in LV6.0?
0 Kudos
Message 1 of 8
(3,406 Views)

a) You can't run frames out of order, as is stated quite clearly if you right click the sequence structure and select Help.

b) If you only want to run the code in some of the frames, you can surround the code in each frame with a case structure and use your condition to decide whether to run or not to run the frame. You should also consider whether you actually need a sequence. If your VIs are connected by wires, they will execute in order. If they are not, you should ask yourself "Can I connect them?". For example, there is no need to use a local variable to transfer data between frames when you can use a wire to directly connect VIs.

c) The most effective and versatile solution is using a state machine. Try looking if File>>New to see if you have a state machine template and search the site to find some tutorials about state machines.


___________________
Try to take over the world!
Message 2 of 8
(3,408 Views)
I am trying to RUN the "information" case followed by the case of my choice. I am having difficulty. If I just RUN the case of my choice I cannot run "information". Can anyone help? The LV in 6.0 is attached.
0 Kudos
Message 3 of 8
(3,376 Views)

Why can't you run the "information" case? Of course currently it does not do anything useful because there is no output defined for the concatenated string.

Please be specific with your problem description. "I am having difficulty" does not tell us much. What happens of you try to run "information"? What do you expect to happen?

As asked before: How are you running this? Why is there no loop in your toplevel VI (MAIN.vi)? Are you using the "run" button or the "continuous run" button?

 

Please define your toplevel VI in the llb. You should NOT include vi.lib VIs, so next time save as Development Distribution and not as Application Distribution.

Message 4 of 8
(3,374 Views)
I want the name of experimenter, sample & description, Date & Time appear on the spreadsheet file or possibly the graphs, ehen I RUN the chosen VI.
0 Kudos
Message 5 of 8
(3,359 Views)
"As asked before: How are you running this? Why is there no loop in your toplevel VI (MAIN.vi)? Are you using the "run" button or the "continuous run" button?" I am using the RUN button. I pick and choose individual cases to RUN. Should I put a loop in my main.vi?
0 Kudos
Message 6 of 8
(3,352 Views)

When you press the Run button, the code in your VI will be executed once. Whatever value is in the controls will be passed to the case structure, and the appropiate case will be executed. If you want more than one case to be executed, you HAVE to use a loop. That's just a basic programming principle. For example, you could use a while loop with a stop button. You could also build a 1D array of selectors and wire it into a for loop to get the order of execution you talked about.

To get the data into the graph or into the file, you will probably have to change how you work a bit. It looks like the easiest thing would be to get the data into a control whenever it changes and to place an indicator near the graph, or add the data to the file when you save. If you want to add text data to the file, you will need to make some modifications. For example, you can open the Write to Spreadsheet File VI to find instructions for how to modify it so you can save text files with it.

I really suggest that you take the advice I almost certainly gave you already and try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(3,343 Views)
Here is a way to run the case of your choice when you choose it.  See attached picture.  Put everything in a big while loop.  Create an event structure inside the while loop as shown.  Add an event for the Choice enum value change.  Add a stop button, and add another event for the stop button.  In the picture, the second event is shown for clarity, but it is really the same structure as the Choice event.  One event structure, two events.  Delete the Timeout event that is automatically generated when you create the event structure.  Move the controls to inside the Choice event.  Wire the True inside the stop event to the loop stop sign.  Edit your list of enums and add a blank item to the top.  Make this the default selection on the front panel (right click on Choice and select Data Operations - Make current value default).  Add a case ""; Default, to the case structure, with nothing in it.  Don't forget to delete the Default word on the previous default case.  Can't have two defaults.  Now when you run your vi, the blank Choice will be selected and the event structure will be waiting for you to choose a Choice.  When you select a choice, that will trigger the proper case to be execucted with the control values that are set.  So you should first set your controls, then make a choice.  After that case is executed, the vi will wait for another choice or the stop button.  When you click Stop, the vi will end.  If you want to automatically run one of the cases before making a choice, like an intialization, place the code before the while loop with some wire (any wire) connected to the loop's edge.  This forces that intialization code to run before the while loop starts.  One thing I forgot, put in a delay inside the loop, but not in the case or the event structure.
- tbob

Inventor of the WORM Global
Message 8 of 8
(3,325 Views)