08-07-2017 09:42 AM
Hello all,
So I have a slightly odd question that I cannot seem to answer with available resources. Is there any reason I cannot write a Data vale reference refnum or notifier refnum to a global variable to be able to access it elsewhere in a project without calling the new DVR vi or obtain notifier VI?
Solved! Go to Solution.
08-07-2017 09:46 AM
That should work, yes.
/Y
08-07-2017 09:49 AM
@theSTEMkid wrote:
Hello all,
So I have a slightly odd question that I cannot seem to answer with available resources. Is there any reason I cannot write a Data vale reference refnum or notifier refnum to a global variable to be able to access it elsewhere in a project without calling the new DVR vi or obtain notifier VI?
Nope. I have done it. Though, I like to keep my Notifiers in an Action Engine where I can have a little more control over it.
08-07-2017 03:55 PM
Thanks so much for the answer! Could you explain what you mean by keeping notifiers in an action engine?
08-07-2017 04:37 PM
@crossrulz wrote:
@theSTEMkid wrote:
Hello all,
So I have a slightly odd question that I cannot seem to answer with available resources. Is there any reason I cannot write a Data vale reference refnum or notifier refnum to a global variable to be able to access it elsewhere in a project without calling the new DVR vi or obtain notifier VI?
Nope. I have done it. Though, I like to keep my Notifiers in an Action Engine where I can have a little more control over it.
I've gone both ways as well. I like the AE because it's nice and tidy; I like the global way because it's easy to set up.
08-07-2017 04:47 PM
@theSTEMkid wrote:
Could you explain what you mean by keeping notifiers in an action engine?
1. Go read the article I linked earlier.
2. Now imagine one with a Obtain Reference (will create if necessary), Send, and Close states.
08-08-2017 10:30 AM
After reading the article you linked, very informative by the way, I took a stab at making a notifier action engine. However it doesn't seem to work as expected. Would you mind taking a glance at the attached code? I assume you can still use action engines to handle notifiers in parallel loops right?
08-08-2017 10:49 AM
You made the classic mistake. Don't worry about it, I did the same when I started down this path.
The point of an Action Engine is that it is non-reentrant so that the same reference can be used everywhere. However, this also means that only 1 process can be running that VI at a time. So when you have one process in the Wait case, nobody else can send anything since the VI is being blocked. The solution is actually quite simple: Do not have a Read/Wait action. Instead, whoever needs to read the notification should use the Obtain Reference case to get the Notifier reference and then use the Wait For Notification outside of the AE. You will need to add an indicator for the Notifier reference to your AE.