07-14-2006 07:59 AM
07-14-2006 10:20 AM
07-14-2006 01:53 PM
05-22-2009 09:27 AM
Another option....
1. Create a user event
2. Fire the user event when the data is written to the shared variable (Source.vi)
3. Register for that user event in 1 or more VI's (User 1.vi & User 2.vi)
4. Now, every time the event fires in Source.vi both User 1 & 2.vi know there is new data. No polling of a shared variable is required.
You DO NOT need the DSC module to do this.
Example files are attached.
05-15-2013 09:57 PM
This works even better if you put the firing of the user event inside an event structure, whose case is the slider (data) changing value.
Then there is no activity when no data changes.
01-09-2014 12:55 PM
I've been studying this example for an hour, and can't seem to understand how it could work the way it is explained. From what I can see, the event is triggered every time the while loop cycles because the event data never changes (or it never triggers the event because the value isn't changing). Either way, writing to the shared variable will not affect this. Is there some sort of hidden functionality that ties the shared variable to the event?
GSinMN
02-01-2014 08:54 AM
Just what I needed.
Getting immersed in DSC/OPC and shared variables. Who'd have thunk Value (Signaling)?
Thanks,
Mark
07-22-2016 07:50 AM
Hi,
I had a visit to the block diagram. The thing is, the shared variable is being fed each 100 ms and at the same time an event is generated in order for the other VIs to recieve it.(It is done 10 times! per second). So, what's the use of it? The whole problem is about the fact that we don't know the time of updating value in the shared variable and there is no intention for polling its value to see if it changes.
07-22-2016 09:45 AM
@MahyarHooshiar wrote:I had a visit to the block diagram. The thing is, the shared variable is being fed each 100 ms and at the same time an event is generated in order for the other VIs to recieve it.(It is done 10 times! per second). So, what's the use of it? The whole problem is about the fact that we don't know the time of updating value in the shared variable and there is no intention for polling its value to see if it changes.
You are commenting on a post that is seven years old in a thread that has not seen activity in years, but yes, that code is not such a good idea in general, even if the timing is slower.
There is a clear race condition (this is the magic word!) in that we don't know in what order things occur. There is absolutely no guarantee that the shared variable has been updated when the event fires.