LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

the data read from shared variable is always 0

Solved!
Go to solution

The lvlib file is on my PC. The shared variable is written on the cRIO vi, and read in the HOST vi. And the variable type is network-published shared variable. 

The timeout Boolean is TRUE, the variable read on HOST is 0.

Is there something wrong?RT vi.pngHOST vi.pngProject.png

0 Kudos
Message 1 of 7
(2,846 Views)

Hi YangPei,

 

did you check the error output of the SharedVariables?

Do both (host AND target) have access to the variables?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,839 Views)

Normally for an RT application, it is better to host the shared variables on the RT target, rather than on the Windows target. Since the RT application would typically run headless (e.g. on startup of the RT target), it would require the PC host to always be connected and have the shared variables deployed. If your PC is not switched on or the variables are not deployed locally, the shared variables on the RT target will error.

 

Drag the shared variable library under the RT target instead of under 'My Computer'.

 

If it still doesn't work then, you might want to check for any possible firewall/network related issues.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 7
(2,817 Views)

Thanks for your reply.

The error code of output is -1950679034.

My firewall has been closed. But the IP address of RT is different from my computer's. Does that matter?IP adress.png

0 Kudos
Message 4 of 7
(2,813 Views)

Thanks for your answer!

I've put the lvlib file under the RT folder, but it didn't work. And the firewall is closed.

0 Kudos
Message 5 of 7
(2,812 Views)
Solution
Accepted by topic author yangpei5215

After you 'deploy' your shared variable library to the RT target, does it show up in the 'NI Distributed System Manager'?

 

I presume when you say the 'firewall is closed' you mean it is open (allows all incoming/outgoing connections). If the firewall is actually closed (blocking connections), then the shared variables won't be able to communicate.

 

What is the error message that goes along with the code? I don't know all of the LabVIEW codes and sometimes the error message has additional information about the error. Searching for the code gives this: http://digital.ni.com/public.nsf/allkb/238D4F85D7EF6A0F86257536006F7718

 

Do you have the shared variable engine installed on your RT target? (look in NI MAX)

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 6 of 7
(2,809 Views)

The IP address of your cRIO does not look correct.  A 169.x.x.x address is the kind of address a device takes if it can't get onto the network.

0 Kudos
Message 7 of 7
(2,785 Views)