From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variable not working

I download example shared variable project and works fine.  So I tried a simple little program and for some reason is not working.  I tried binding and also in the block programming.  I did deploy the library like it says to do as well.  I can't figure out why this isn't working.  Is there something else I need to do in the project settings or something?  I had a similar small program working but was a while back and don't remember what I did other than just use the binding dialog to connect to the shared variable server on the network.

 

Trinity32244_0-1648821909113.png

 

Trinity32244_1-1648821927855.png

 

Trinity32244_2-1648821987254.png

 

0 Kudos
Message 1 of 7
(1,398 Views)
  • Do you get any error messages?
  • Is the shared variable engine running?
  • Why do you spin the loop as fast as the computer allows
  • Why do you write and read without data dependency, i.e. in random order?
  • Can you attach your code and tell us exactly how you use it?
0 Kudos
Message 2 of 7
(1,381 Views)

You are right, and I just threw this together for proof of concept for a much larger application I am building.  I did go ahead and add a wait and the error indicators (-1950679034 is the error on writing).  I attached the code.  When I looked up that error, it did say something about the DSC module which I do not have and didn't think that was any kind of requirement for using shared variables.  Thanks for you help in advance

0 Kudos
Message 3 of 7
(1,351 Views)

a lvproj file does not contain any usable code. we need also the VI(s) next to it.

 

I also cannot open LabVIEW 2021 Code, consider "save for previous".

 


@Trinity32244 wrote:

s (-1950679034 is the error on writing).


Error -1950679034 is "LabVIEW: (Hex 0x8BBB0006) The shared variable has no value." So start there!

0 Kudos
Message 4 of 7
(1,341 Views)

Sorry about that.  See attached

Download All
0 Kudos
Message 5 of 7
(1,315 Views)

You still have no data dependency, so you might be reading before ever writing (execution order of parallel code fragments is not predictable).

 

Now we are missing the lvproj file.

0 Kudos
Message 6 of 7
(1,282 Views)

Sorry about that and attached it.  Also, I would think the subsequent read would reflect the shared variable value correctly though, right?

0 Kudos
Message 7 of 7
(1,276 Views)