LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistent Network Shared Variables

I will eventually be implementing a controls program on a machine using cfp. Before the cfp gets here, I am getting practice in network shared variables by trying to pass shared variables between two VIs on my computer. I have attached the two VIs and a screen shot of my project. I run a queued state machine and after the initialization routine is done, I run the control portion of the program. The control program is titled 'The4Mprocedure2.vi' and the QSM is titled '4M_QueueDrivenStateMachine'. In the initialization routine of the QSM, 'FALSE' is written to the boolean network shared variable, 'Run_4M_Procedure'. After the initialization routine is done, and a set of certain parameters are met, the QSM writes the value 'TRUE' to 'Run_4M_Procedure'. Ideally, The4Mprocedure2.vi would read the shared variable, and when the value is 'TRUE' The4Mprocedure2.vi would run. The4Mprocedure2.vi has a case statement that causes to run the program when 'Run_4M_Procedure' = TRUE. The4Mprocedure2.vi does not run when the variable is FALSE.

The problem that I am having is that The4Mprocedure2.vi does not always recognize that the value of my shared variable has changed. When the QSM passes the value of 'TRUE' to the controls program, The4Mprocedure2.vi will sometimes still read the network shared variable as FALSE. Sometimes, I have to restart the controls program several times while the QSM is running to ensure that 'TRUE' is passed to the controls portion. Why does my controls program not recognize when the network shared variable changes values?


Message Edited by tquintana55 on 07-14-2008 11:04 AM
0 Kudos
Message 1 of 3
(2,307 Views)
Hi tquintana55,

I believe your Issue is related to the methods that LabVIEW subscribes to the shared variables. Here is a link to a related article:

How to Avoid the "0" Value at First Read of a Shared Variable in LabVIEW 8.5.x?

To resolve this you can move your Run_4M_Procedure inside the while loop.
Sappster
0 Kudos
Message 2 of 3
(2,298 Views)
Moving the shared variable inside of the while loop solved my problem. Thank you.
0 Kudos
Message 3 of 3
(2,280 Views)