LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to repeat a stacked structure sequence?

Hello,
I have a program that runs under a stacked structure sequence.
Now i want it to repeat to the first frame every time the sequence is over.
can this be done? how?
 
thanks in advance
Eyezik.
 
0 Kudos
Message 1 of 7
(5,673 Views)

Hi Eyezik,

use a while loop to do that. And now if you change to a loop, try to rebuild your code to a state machine architecture. If you do that, you can jump to each fram (then case) you want.

Mike



Message Edited by MikeS81 on 05-09-2008 02:47 PM
0 Kudos
Message 2 of 7
(5,669 Views)
Hi!
   simply put it inside a while loop!

   But, maybe you can provide more details, because this can be a poor technique, in some cases... perhaps you need a conditional execution?

graziano
0 Kudos
Message 3 of 7
(5,665 Views)
Great!
i put a while loop around the whole sequence and it worked like a charm.
thank you so much.
 
Eyezik.
 
 
 
 
0 Kudos
Message 4 of 7
(5,660 Views)
Hi Eyezik!
   A little tip, repeated in many places on this forum: when possible, avoid using stacked sequence structure, use instead flat! Stacked S hides code, and make it less readable and debuggable.  Of course, Stacked S saves space on the screen, but not always this is good, since when diagram becomes huge, it's time to modularize.  So, it's good to force ourself to code keeping "clean" block diagrams!

   Let's go further, if possible, use subVIs, in cascade, and force sequence execution with dataflow (the error out of the first subVI to the error input of the second, etc...)

graziano

PS.: this is my advice, but you'll find a reference in "the labview style book"
Message 5 of 7
(5,645 Views)
I would also like to add to that. As mentioned above, if you have to repeat the stacked sequence structure, using a while loop works but it is not proper technique. Convert the code into a state machine, which is basically the same except that it uses a case structure and it allows you to control the sequence of the execution of the states. Using this architecture allows you to "modularize" your code a little better than using a stacked (of flat) sequence structure.
Eli S.
National Instruments
Applications Engineer
Message 6 of 7
(5,611 Views)

To have better understanding about state machine architecture, read here and here.

Mathan

0 Kudos
Message 7 of 7
(5,589 Views)