Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Periodic Task Shift Register (http://www.chiefdelphi.com/forums/showthread.php?t=142487)

Bpk9p4 01-24-2016 09:14 PM

Periodic Task Shift Register
 
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?

Greg McKaskle 01-24-2016 09:27 PM

Re: Periodic Task Shift Register
 
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

Bpk9p4 01-24-2016 09:32 PM

Re: Periodic Task Shift Register
 
thanks for the quick response. So what would change the changed the refnum in the loop?

Greg McKaskle 01-24-2016 09:38 PM

Re: Periodic Task Shift Register
 
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

Bpk9p4 01-24-2016 09:52 PM

Re: Periodic Task Shift Register
 
so is doing something like the picture bellow a bad idea
http://imgur.com/JxM5yiX

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

http://imgur.com/2M8YjDV

Greg McKaskle 01-26-2016 08:51 AM

Re: Periodic Task Shift Register
 
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

Bpk9p4 01-26-2016 08:56 AM

Re: Periodic Task Shift Register
 
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?

aeastet 01-26-2016 10:21 AM

Re: Periodic Task Shift Register
 
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.

Bpk9p4 01-26-2016 01:11 PM

Re: Periodic Task Shift Register
 
you just made my day. I will look into tonight and give this a try.

Greg McKaskle 01-26-2016 03:11 PM

Re: Periodic Task Shift Register
 
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


All times are GMT -5. The time now is 06:11 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi