02-27-2012 07:04 AM
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.
Solved! Go to Solution.
02-27-2012 07:25 AM
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.
02-27-2012 07:37 AM
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?
02-27-2012 08:31 AM
I haven't been able to pin down the exact circumstances of the "sometimes". Still working on that...
03-05-2012 11:52 AM
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!