LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize Shift Register on Every Subvi Run

Is it possible to have shift-registers or feedback nodes use the initialisation value each time a loop or sub-vi is entered, rather than storing the value from the last execution?

 

This has been causing me a fair bit of hassel, and finding a suitable workaround each time is a bit of a pain and inefficient.

0 Kudos
Message 1 of 6
(3,302 Views)

Wire the value to the input of the shift register with the value that you want to initialize with.

-----

The best solution is the one you find it by yourself
Message 2 of 6
(3,299 Views)

This works fine if the vi is a stand-alone, but if it's a sub-vi then each time that sub-vi re-executes, rather than using the value wired to the initialisation terminal it uses the last value from the previous execution. That's what I'm trying to avoid - I want it to reinitialise every time that  loop is entered.

 

Similarly with feedback nodes, they're only initialised when the subvi is first run. I'd rather they were initialised every time it's run, when the sub-vi is first entered.

 

0 Kudos
Message 3 of 6
(3,269 Views)

No I guess you are missing some thing. Can you post the Shift register code as a snippet.

 

SR_Init.png

 

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 6
(3,263 Views)

This is/was what I've been doing, though I've been playing around this morning and for some reason haven't encountered the same behaviour I was experiencing on Friday - I must've been doing something incorrectly.

A stripped down version of my loop situation is something like this:

 

 

I thought i was finding that my shift registers were all returning true and my feedback node the array the loop last exited on. This meant for every other execution it would immediately break, and i'd have to run it twice to have it actually run to completion.

This morning my feedback node isn't getting reinitialised, but the shift registers are, so it's working...If it starts playing up again I'll post back, but presumably this must just have been a friday afternoon brain fart. 😕

 

Thanks anyway P Anand!

 

0 Kudos
Message 5 of 6
(3,225 Views)

If it happens with the feedback node, check the globally initialize item in context menu: it can initialize "on first call" or "on compile/load". Or move the initialization terminal to the loop border (move the terminal one loop out): if it is unwired, it is uninitialized.

0 Kudos
Message 6 of 6
(3,208 Views)