LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update shared variables within a project

Hello everybody,

 

I want to carry data within my VIs and I'm using shared variables. Sometimes the value of the data has to be updated so the following operations are done: writing of the variable in VI#1, reading it in VI#2, writing new value it in VI#3, reading it VI#2.

My problem is that the value is not updated. I search the forum and the help but I could not find any thread addressing this issue.

 

Thanks in advance for your help.

Sylvain

 

0 Kudos
Message 1 of 5
(2,651 Views)

...sounds to me as if this could be a data flow related issue. Could you post a simple example of your code or a screenshot of what your a doing?

0 Kudos
Message 2 of 5
(2,623 Views)

Thanks for your reply.

 

Here is a short example.

At the beggining (VI#1), the user is asked to log in. If it is user morelsv, it is possible to activate the test mode.

Then other VIs are run and finally in VI#4, depending on whether the test mode has been activated or not, different actions will be made.

 

Now, my problem is:

user morelsv logs in and activate the test mode -->test mode = true

user morelsv logs off.

another user logs in so test mode changes to false (VI#1) but in VI#4, test mode still = true... no update of the shared variable is done.

 

I hope that helps to understand my issue.

Download All
0 Kudos
Message 3 of 5
(2,615 Views)

Hello!

 

I don´t know, what your LabVIEW-Skills are, so perhaps this answer is silly for you:

When the new user logs in, is the loop in V4 still running? What I see from your Screenshot (V4), the variable is read only once at the beginning of the VI. Changes to the Varaible have no effect, so it can´t work.

 

If that is not your Problem, is this your flow?

1. User 1 logs in, Variable is written, Pause, VI 4 starts, Variable is read, Loops starts, User 1 logs of, VI 4 stops

2. User 2 logs in, Variable is written, Pause, VI 4 starts, Variable is read --> False Value

 

Do you share your variables over the network? When you use only one Computer, try just for testing a global variable and see if this works. Helps finding the error: if it works with a global variable, we look further at the shared variable, if not, we should look closer to your programm.

 

Regards

 

 

0 Kudos
Message 4 of 5
(2,598 Views)

Hello.

 

My labview-skills are very poor since I never had proper training. All information is then welcome 🙂

 

When the new user logs in, the loop in V4 is not running anymore.

Also, I believe that my flow is correct, otherwise I would have other issues (for instance the user ID would not be correct)

 

I have actually no need to share these variables over the network. I have replaced the shared variable with a global variable and it works fine.

For the need of my programm, the issue has been solved.

I would be however be curious to understand why the upate of the shared variable failed.

 

So thank you very much for your help.

 

Regards,

Sylvain

0 Kudos
Message 5 of 5
(2,560 Views)