04-20-2012 09:16 AM - edited 04-20-2012 09:18 AM
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.
04-20-2012 09:21 AM
Wire the value to the input of the shift register with the value that you want to initialize with.
04-20-2012 11:39 AM
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.
04-20-2012 11:47 AM
No I guess you are missing some thing. Can you post the Shift register code as a snippet.
04-23-2012 05:19 AM - edited 04-23-2012 05:20 AM
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!
04-23-2012 09:19 AM
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.