09-23-2011 07:45 AM
Below is an image from "syslog_Device Function Engine.vi". This isn't really a question specifically about this vi, but rather a technique I see here.
First thing I noticed was a while loop that always exits, never loops. And shift registers. Is this used so that the VI can retain values between calls, almost like what I would consider local variable that are persistent between function calls in another language? This is an interesting way to accomplish this that I haven't considered.
Please tell me if I'm missing what's going on here.
Solved! Go to Solution.
09-23-2011 07:53 AM
That is an Action Engine.
It is a code construct that allows encapsulating data and functionality that can be accessed in multiple threads.
The nugget I linked above explains their operation the theory behind them and the follow-up discusion talks about how to exploit them.
Good questin by the way!
Ben
09-23-2011 08:16 AM - edited 09-23-2011 08:18 AM
One thing to note- just because a true is wired to the stop terminal, the while loop will actually iterate one time. You may already know this but its a little hard to tell from your wording so I just wanted to clarify. I'm fairly impressed though that you caught on to the purpose of this action engine or functional global technique by just looking at the code. It can often go right over the head of many a new LabVIEW developer
09-23-2011 08:19 AM
for(imstuck) wrote:
One thing to note- just because a true is wired to the stop terminal, the while loop will actually iterate one time. I'm fairly impressed though that you caught on to the purpose of this action engine or functional global technique by just looking at the code. It can often go right over the head of many a new LabVIEW developer
Ditto that.
The first time I saw that construct I called the developer and read him the riot act "...and you didn't even bother to initialize the shift registers!"
Ben
09-23-2011 08:22 AM
@Ben wrote:
@for(imstuck) wrote:
One thing to note- just because a true is wired to the stop terminal, the while loop will actually iterate one time. I'm fairly impressed though that you caught on to the purpose of this action engine or functional global technique by just looking at the code. It can often go right over the head of many a new LabVIEW developer
Ditto that.
The first time I saw that construct I called the developer and read him the riot act "...and you didn't even bother to initialize the shift registers!"
Ben
Where's the foot-in-mouth smiley when you need it 🙂