11-27-2020 01:13 AM
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.
11-27-2020 01:13 PM
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:
Bob Schor
11-28-2020 04:22 AM
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.
11-29-2020 11:01 AM
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
11-29-2020 04:04 PM
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?
11-29-2020 06:06 PM
@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.