LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I read/write global variables that are in other PC?

I attach the vis and the executables.
My problem is that when I run( continuosly, because in other way, I read the default value of the variable) getvalue.vi and setvalue.vi, I don´t have any problem, I can read/write the global variables, the two vis is running in the same PC.
But when I do the exe and I run them continuosly , it doesn´t work.
Any solution?

Thanks in advanced!

Graci
Download All
0 Kudos
Message 1 of 2
(2,712 Views)
Hello Bichillo,

By running the vis continuously you are running into race conditions. If you cannot control when you are writing to or reading from a global variable, you cannot know whether the value writen/read is the right one or not.
In your case the global variable value that is read is sometimes the last value writen and sometimes an empty string.
To make the global variable behave as desired, that is, keeping its last value, the global variable must be in memory when you access it using VI Server. If it is not in memory, the returned value is an empty string. That´s why you sometimes get a non-empty string: when you access the global variable to read its value, it happens to be in memory because you´ve just writen to it.
To ensure that the global
variable is always in memory and it keeps its last value, you must include the global variable into your block diagram. I am attaching modified vis that implement this.

Hope it helps.
César Verdejo
Training and Certification | National Instruments
0 Kudos
Message 2 of 2
(2,710 Views)