Does anyone know the reason for the shift register in time tasked for all the DevRef. From what i can tell it could just be a normal tunnel. Is this true?
It is mostly a habit. If something inside the loop changed the refnum ( the value, not the thing that is referenced ), this wouldn’t work without the shift register. For 99% of the cases, the tunnel and shift register are equivalent.
Greg McKaskle
thanks for the quick response. So what would change the changed the refnum in the loop?
The most obvious would be a close followed by open. I’m not sure if any of the I/O VIs will change the cluster, but if they did, the shift register approach is the right one.
Greg McKaskle
so is doing something like the picture bellow a bad idea
Last year we did something like the picture bellow and every time we added a RefNum we had to change all inputs and output names. I was hoping by doing something like the above it would make it easier
The top picture uses a local variable to hold a refnum instead of passing it by wire. The issue here is that nothing guarantees that the variable has been written to before it is read from.
The bottom image is much more complex code, but I only see one refnum that is in a cluster. If that were a cluster of refnums, you’d add to the cluster and access by name whenever you need it. So I’m not sure I follow.
The code below would be a bit cleaner if the subVIs were modified to take in higher level inputs. So instead of passing in a dozen Booleans, group them in your Var so that they make sense together for passing together. Not sure if that is easy, just seems like it might be applicable here.
Greg McKaskle
thanks for the input.
The main problem i am trying to overcome is when you cluster items together and then feed them out of a subvi every time you add anything to that cluster it breaks the line and you have to go in and update all your inputs and outputs. Is there a way to auto up date those?
You need to look into Strict Type Defs. If you use these then they will update in your code anywhere they where used. They are very awesome and will make your life so much easier.
you just made my day. I will look into tonight and give this a try.
I was wondering if that was what you meant by name changes. Typedefs update when the data type of the .ctl file is changed. Strict typedefs update when any aspect changes, and disallow instances from most editing. Strict Typedefs are generally used for UI consistency, and typedefs for type consistency.
Greg McKaskle