LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a Value Change Event for Shared Variables on myRIO

I have a question about Shared Variable in Event Structure in myRIO. My myRIO is connected to the computer via USB. On the computer I have a VI, so the user can control the myRIO. Therefore I work with shared variables. Now I wanted to ask if there is a way to create a value change event of a shared variable on myRIO?
Thanks for your help.

0 Kudos
Message 1 of 6
(967 Views)

This is where a little bit of code (even if it didn't actually work, but to illustrate what you are attempting to do) would really have helped (you'd need to make a small Project and attach the entire Project folder, compressed into a .zip file).

 

Here are the questions that come to mind:

  • Are you trying to create the Event Structure on the Host, to respond when the Target changes the Shared Variable?
  • Are you trying to create the Event Structure on the Target, to respond when the Host changes the Shared Variable?
  • Are the Variables "hosted" on the Host or the Target?
  • How much of a "latency" can you tolerate?  [This has special import if the "obvious solutions" don't work, and you need to use a "check every-so-often" loop].  Note that there is always a latency anyway, as the Shared Variable engine needs to use TCP/IP to transfer the Shared Variable between Host and Target.

Bob Schor

0 Kudos
Message 2 of 6
(934 Views)

Hey Bob,

 

thank you for your reply.

There is an event structure on the host and on the target. The shared Variable are changed on the host and on the target, but they are different, some are only changed on the target the others only on the host. The latency should be as low as possible.

I tried with the DSC-Library, but I always get an error on the target. On the host It works without any problems. Maybe you can help me or is there another way than the DSC-Library?. The Program and a picture of the error are attached.

 

PS: Sorry for my bad English.

Download All
0 Kudos
Message 3 of 6
(918 Views)

I don't use Shared Variables for communication between Host and RT Target.  Instead, I use Network Streams, with a Message Stream going from Host to Target and another Message Stream going from Target to Host.  Both Host and Target have loops running to read the Message Stream and enqueue any Message to the QMH -- this works quite well, and results in a very compact and easy-to-understand (and debug) architecture.

 

However, I did find a reference to How to Create Event Triggered by Change in Shared Variables , which also contains a reference to some example code, which may be helpful to you.

 

Bob Schor

0 Kudos
Message 4 of 6
(906 Views)

I have found out, that the LabVIEW Datalogging and Supervisory Control Module is only available for Windows Hosts, thats very bad. Why do you don't use Shared Variable for communication between Host and RT Target?

0 Kudos
Message 5 of 6
(893 Views)

@b.boesch wrote:

Why do you don't use Shared Variable for communication between Host and RT Target?


1. Security.  Anybody on the network can write updates to the variables.

2. Speed.  Shared Variables are slow and introduce all kinds of weird race conditions.

 

Personally, I use the raw TCP communication nodes.  I am also a fan of the STM library with TCP.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(889 Views)