04-28-2013 07:16 AM
Hello everyone!
If I make the programming with a main while loop outside, then inside it there is a case structure with a for loop in the innest. If I want to create the shift register for for loop and would like to let the shift register only remember the current value after the calculation in the for loop.
So would anyone please give me some instructions on how to initialize the shift register so that everytime when case structure functions, the for loop will not be initialized to the very beginning initial value?
PS: the while loop is for the controlling of the whole vi with a stop button to stop it.
Thank you very much!
04-28-2013 07:30 AM
Can you put the shift register on the outer while loop?
Rhys
04-28-2013 01:04 PM
04-28-2013 01:47 PM - edited 04-28-2013 04:53 PM
I would put an initialized shift register in the while loop in addition to the shift register of the FOR loop and wire them all together.
04-28-2013 04:06 PM
Thx, sorry but I am not quite clear, in that case should I also add a shift register on the outer while loop? Or just on the inner for loop?
If former, what do you mean by initializing it inside the while loop?
Best regards!
04-28-2013 04:08 PM
Thx, is that to say adding the corresponding shift register on the outer while loop and also put the initial value outside the while loop?
04-28-2013 04:52 PM - edited 04-28-2013 04:53 PM
Yes, an initialized shift register at the while loop boundary has the initialization on the outside of the while loop.
04-28-2013 05:24 PM
A nice solution I use for this type of situation is to replace the Shift Register with a Feedback Node, and move the Initializer out to the outermost loop (or wherever you want it). So it would look something like this:
This saves on running wires through parts of the code that don't need to know about this value.