10-12-2017 10:29 AM
Hi,
I am really new to LabView. I've been trying to set up a project with several VIs in it. The challenge here for me is to make the VIs happen in a certain order. For this, I've put some stacked sequences and while loops (because each VIs contain an "elapsed time". The thing here is that each VIs are also related to one same value (a control). But when the control is outside the loops, it does not work anymore.
I think the picture above is the solution for my problem. Basically, I need to "refer" to the same control withing different frame and loops. Could this work?
And could you tell me what is this function? And how to create it?
Thank you very much for your help!
Solved! Go to Solution.
10-12-2017 10:38 AM
right mouse button on the control-> Create local Variable.
The local variable can be changed to read / write mode. Also on the right mouse button
10-12-2017 11:11 AM
Instead of peppering the diagram with stacked sequences and local variables, do a few simple tutorials!
Look into a state machine architecture. Show us what you have and we will point you in the right direction.
(stacked sequences and local variable overuse are a hallmark or beginner code that will scale very poorly in the future).
10-13-2017 04:06 AM
Thank you so much! Exactly what I needed
10-13-2017 04:11 AM
Hi,
I attached the project and the diagram of how it is supposed to work.
(The diagram says "read", which is on this project simply controls.)
Do you really think the sequences are too much? I'm not sure if it is possible to get rid of it. If you have time to take a look, that would be great 🙂
Thank you!
10-13-2017 05:41 AM
@Charly.-- wrote:
Do you really think the sequences are too much? I'm not sure if it is possible to get rid of it. If you have time to take a look, that would be great 🙂
Of course it's possible to get rid of sequences. I have +3000 VI's in just one project and not a single sequence structure (ok maybe one or two).
Do some tutorials, including OO tutorials. Learning to program OO is not more difficult then learning "normal" programming. Might as well start learning to program properly from the start .
Here's my philosophy. The control is an object you want to use. Put it's reference in the init of a class. Make methods that have error in and error outs (like all VI's should have). The error in\out's will force synchronised execution.
If you need to wait, add a timer class (could be very simple), and put them between the VI's you have.
No sequence structures are ever needed. During testing they are sometimes convenient, but they are never needed and very undesirable.