LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create an event listener to the change of shared variable or similar?

Solved!
Go to solution

Hi,

 

I have a 'large' measurement system of 6 devices communicating via TCP protocol. The system is designed to use REST (representative state transfer) with JSON (JavaScript object notation).

 

Now, I need to add labview program to this environment. I have established a 'working' solution with the help of this forum. Thank you for that! Now I need to make it better (currently no timestamps, large delays, etc).

 

I currently have a deployed web service using http-get as input. My web service .vi is just passing the web input to shared variables, which are then polled in the real measurement program. Reason for this is that when I put the measurement program directly to web service, it does not work (something about dependencies and rights). Measurement program includes a third party proprietary drivers (Instron). Also I would not like direct access via network to our potentially dangerous mechanical testing device.

 

Now I want to change the message passing from web services .vi to the measurement .vi. Currently I have a 10 ms loop polling for changes in shared variable. Is there a better way of doing this? I was thinking of creating an event listener for changes of the shared variable.

 

Also, if you have some ideas (preferably working example code) how to do the interface between labview and TCP-JSON I would really appreciate it.

 

br,

juha

 

 

 

 

0 Kudos
Message 1 of 6
(3,895 Views)
Solution
Accepted by topic author JuhaK

Currently in LabVIEW the only way to create an event listener or a NSV event is to use the DSC toolkit.  For the most part the DSC is a very expensive toolkit that just wraps functionality that is built into the PSP and SV engine and which is available to anyone who can program in LabWindows/CVI.

http://zone.ni.com/reference/en-XX/help/370051P-01/cvi/libref/cvicnvcreatesubscriber/

If you would like to work together, I would love to create a small LV library that would create basic SV events either by using a LV vi callback or possibly passing back a LV user event which is how the DSC toolkit works.  I have asked NI many times to explain how to do this and they are very tight lipped about it.  I guess they do not want to give LV users less reason to buy the DSC.

Message 2 of 6
(3,875 Views)

 

hmm, I have to look into this DSC toolkit...

 

Otherwise, creating a small LV library doing this does not sound bad, if you already have some ideas how to do it. My angle to this is a bit general, though. The events created and listened should be able handle also outside labview. This should be only a minor addition as labview has some activeX support (windows programming only).

 

br,

Juha

0 Kudos
Message 3 of 6
(3,865 Views)

 

Ok, I think that the DSC-toolkit provides the necessary tools. As I am working in a big university the toolkits are not a problem...

 

If you want to do some developement with a more simple/general/free event-handling I am all ears.

 

br,

Juha

0 Kudos
Message 4 of 6
(3,858 Views)

NI's MeasurementStudio provides this event

 

public event System.EventHandler<DataUpdatedEventArgs<TValue>> DataUpdated
    Member of NationalInstruments.NetworkVariable.NetworkVariableSubscriber<TValue>

Summary:
Occurs when new data is available to NetworkVariableSubscriber<T>.

Best regards

Christian

0 Kudos
Message 5 of 6
(3,853 Views)

Hi All,

I am trying to create event handler in VB2008 to handle change in shared variable values. Unfortunately I don't have access to DSC module of NI.

From your mentioned answer could you please elaborate this Dataupdate event handler from Measurement studio.

Many thanks in advance.

Awaiting for your response.

 

SKhilar

0 Kudos
Message 6 of 6
(3,536 Views)