LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where to place Sequence Locals in a Sequence Frame? up, down, left right?

Solved!
Go to solution
If you don't want to consider a proper program architecture due to the added complexities (which go away once you become used to doing things the right way), why not just let the code grow horizontally.  It is "frowned upon" to let your block diagram get larger than your screen but that's just a convention and horizontal scrolling isn't considered too bad.  In any case, ANYTHING is better than the confusing mess of a deep sequence structure filled with locals.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 11 of 26
(1,133 Views)

Once you go down the path of the dark side (sequence structure), forever will it change your destiny.  Please use a state machine.  I have attached a template for you to get started.  Anything you wanted to put in sequence locals should go into the Local Variables cluster.  Just copy your code from each frame and place it into a case in the case structure.  Easy to do, won't take long, and you will be very thankful the first time you need to modify your code.  Don't say it will never need mods.  we have all said that at one time or another, and we have all been wrong.

 

 

- tbob

Inventor of the WORM Global
Message 12 of 26
(1,114 Views)
If ONLY I could show the OP some of the old code I have access to. One look at it will make you realize why stacked sequences are AWFUL, most notably the sequence locals almost always cause wires to go BACKWARDS!!!Smiley SurprisedSmiley Mad How's that for throwing a wrench in making-dataflow-easy-to-follow?
0 Kudos
Message 13 of 26
(1,091 Views)

"Once you go down the path of the dark side (sequence structure), forever will it change your destiny."   by Tbob

 

 

Thats just awesome Tbob, haha Smiley Very Happy

 

 

May the force be with you,

Christian

0 Kudos
Message 14 of 26
(1,076 Views)
The OP has only to download a random selection of device drivers.  Even the ones from HP, Keithley and other big names are full of sequence structures and other bad coding practices.  Of course most of them are quite old.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 15 of 26
(1,075 Views)

Christian_M wrote:

"Once you go down the path of the dark side (sequence structure), forever will it change your destiny."   by Tbob

 

 

Thats just awesome Tbob, haha Smiley Very Happy

 

 

May the force be with you,

Christian


I thought the dark side was local variables. No, wait, it's global variables. No, wait, it's Express VIs. No, wait, it's the GOTO statement. No, wait, it's actually the NI boards (at least according to LAVA).

 

The dark side is so much more fun. 

Message 16 of 26
(1,054 Views)
The loop I mentioned has most of the features of a state machine. You could pass the next state via a shift register. And it is certainly better than a staked sequence.
0 Kudos
Message 17 of 26
(1,039 Views)

@smercurio_fc: The dark side of the force is a path way to many abilities (locals, globals, ....forums) some consider to be unnatural    (The Emporer in Episode III)

 

 

Christian

0 Kudos
Message 18 of 26
(1,001 Views)

@all:

Ok, I will modify my VI and replace the huge stacked sequence with a state machine, although my current VI works quite well and although I have no problem with hundreds of local variables.

 

I will probably understand you better, as soon as I have some experience with state machines.

 

Thanks for your help!

 

 

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 19 of 26
(981 Views)

johanneshoer wrote: 
although I have no problem with hundreds of local variables.


You think you have no problem with hundreds of Local variables..  

Bouahhh aahhh ahhhh ahhhh aahhhhhhhh...    😄

 

If you have more than 1 Local Variable, you may be sufferring from Localitis.  Hundreds??  You are either brave or nuts.  Well... the or is probably more of an AND..  😉

 

Locals have this way of biting you in the back of your pants when you least expect it.  And debugging becomes a complete nightmare.

 

If you're going to fix the code, why fix half of it.  Go all the way..  Get rid of Locals.

Message 20 of 26
(968 Views)