LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to generate a user event when shared variable value change on RT target?

Hi,

 

    I wonder if it is possible to generate a user event when a network published shared variable value change?

 

    Thanks a lot!

 

    Regards,

 

    Tom

0 Kudos
Message 1 of 5
(3,983 Views)

You generate an event for the SV change using dynamic event registration.

 

There are several examples out there on using dynamic events.  Have a look at this one that could be easily modified for your case.

http://decibel.ni.com/content/docs/DOC-5265

 

Replace the switch with your shared variable node and edit the event case as desired.  If you need to monitor the SV for T-F or F-T change then just add a shift register.

 

 

Dan

Message 2 of 5
(3,975 Views)

Hi Dan,

 

    In your example you still need to poll the shared variable to generate the event. I try to avoid polling the data and would like to have shared variable generate user event when its value change.

 

    Thanks!

 

    Tom

0 Kudos
Message 3 of 5
(3,969 Views)

Tom,

 

I understand not wanting to waster resources on polling but I am not aware that LabVIEW can automatically generate an event on a SV change.

 

Maybe a better solution...

You could implement lower level TCP communication (i.e. have a look at STM - simple messaging protocol) for passing data betweeen RT and PC (instead of using a SV).  You could send a generic command (boolean trigger maybe?) from your RT system when the value of whatever it is the SV is storing has changed.  You can avoid polling on the non-RT system this way.

 

 

Dan

Message 4 of 5
(3,961 Views)

Unfortunately in LV you need the DSC toolkit to register for NSV events.  This will only work for windows hosted NSV's.  It appears that CVI natively supports NSV events

on any platform but as of yet there are no LV wrappers for this functionality.

Message 5 of 5
(3,904 Views)