LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shared variable

Hello,

 

Im using CRio 9022, Labview 8.6.1 and I'm trying to make the shared variables to work. I run the code in the CRio(which has several timed loops and while loops) and then run the PC program and it seems that just the first time I run the programs the variables are updated, but then the variables are not updated anymore. What I mean is that if I change a value  of one of the shared variables,then run it, it will be reflected on the PC or in the CRio, but just the first time I run it, after that even if I change the value of the shared variable, while the program is running, it won't be reflected.  I followed this help http://digital.ni.com/public.nsf/websearch/6E37AC5435E44F9F862570D2005FEF25?OpenDocument but didn't get any results.  I also used the distributed system manager but even there the change does not gets reflected. The variables are deployed correctly on the CRio, but still don't get it to work. One more thing, I have the shared variables running in the CRio.

 

Thanks in advance,

 

Hector..

0 Kudos
Message 1 of 6
(3,550 Views)

I just find out that if I run the CRio code, and play with the NI Distributed System Manager, I'm able to change the value of the Shared Variables, but as soon as I run the PC code, the values change to the ones I have set in the PC code and after a while all the variables disconnect but both programms keep running.

0 Kudos
Message 2 of 6
(3,545 Views)
I just created the simplest code I can and get the following error.
0 Kudos
Message 3 of 6
(3,525 Views)

Hello Hector,

 

It looks like you may be losing connection to your shared variables.  This might happen if there is thread starvation occuring on the cRIO.  Do you have any loops that are running at high data rates?  Can you get shared variables to work with a simple cRIO application?  If so, post your RT code so we can take a look at it.

0 Kudos
Message 4 of 6
(3,513 Views)

I thought so too but then I created a single project with the just the basic program and it seems to work only from the target to the Host but not the other way around. The shared variables are updated if they are sent from the Target to the Host but not when I send from the Host to the Target. Attached is the simple project and programms I'm using to test this. I also tested it both with a cable network and with wireless and in both cases had the same result.

 

Regards,

 

Hector.

 

0 Kudos
Message 5 of 6
(3,506 Views)

Hello Hector,

 

I don't see a wait in either of your loops.  Try adding a small wait function to your cRIO RT code and see if that helps anything.  Without that wait, the Shared Variable Engine running on the cRIO may not have time to update its variables properly. 

0 Kudos
Message 6 of 6
(3,491 Views)