LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delay in writing shared variable

Solved!
Go to solution

Hi all.


I am using LV 2010 SP 1 on a Windows platform.

 

I have a boolean front panel indicator and a boolean shared variable that I write to simultaneously. My shared variable is network published with buffering enabled.

 

Elsewhere in the same program I read the boolean shared variable*. My problem is that sometimes there appears to be a delay updating the value of the shared variable. The front panel indicator changes, but when I poll the shared variable it takes a few seconds of repeated polling before its value also changes.

 

Has anybody else seen this problem? Is there a simple fix?

 

Thanks,

Zola

 

*Yes, I know I can use the single process shared variable setting to communicate within a program, but the shared variable is also used in another monitoring program. 

0 Kudos
Message 1 of 5
(4,122 Views)
Solution
Accepted by topic author zola_the_gorgon

Check whether you are writing the data continously and read it at the same rate. Since you are using buffer if the recieving part is not fast enough to read the data as your writing speed it may take time to read the data and thus it looks like a delay for you. Try disabling the buffer and just use it like a global variable.

-----

The best solution is the one you find it by yourself
Message 2 of 5
(4,115 Views)

I used Shared Variables a few years ago and was disappointed (shocked, actually) to find that they took > 0.03 seconds to update.  That was bad, but not as bad as you're reporting.  I don't think there's anything inherent in Shared Variables that will explain your situation.

 

Have you been able to identify what's going on when you get the "sometimes" delay?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 5
(4,112 Views)

I haven't been able to pin down the exact circumstances of the "sometimes". Still working on that...

0 Kudos
Message 4 of 5
(4,106 Views)

Yep, you are totally right. After re-reading the docs on LV shared variable buffering for about the fifth time (http://zone.ni.com/devzone/cda/tut/p/id/4679), I finally got it. I had buffering on, and I was writing to the shared variable more often than I was reading it, so when I stopped updating the shared variable, it took a few reads to catch up. Duh.

Switching buffering off fixed my problem.

 

Thank you!

0 Kudos
Message 5 of 5
(4,088 Views)