LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview real-time control (NI-DAQmx) template - global variable vs. single-process shared variables

Hello,

 

I am new to the real-time system development using labview. I hava a generic understanding of what global/FG varibles, single-process/network-published shared variables are and how they are used. My question is specific to the template avaliable when you create a new project in labview called, "labview real-time control (NI-DAQmx)". It is under --> Create Project --> Sample Projects --> labview real-time control (NI-DAQmx).

 

My question is, "what is the basis for diffrentiating the use of global variables and single-process shared variables in this specific example?" From what I can tell, those two are pretty much identical in its functionality. I wouldl like to know what the author's intention was in choosing which one to use for which data in this particular example. In fact,  why don't I thow in the functional globals that are being used in my question as well.

 

I appreciate your time for looking into this. Please redirect my question to a relevant post if the question has been addressed in the forum already. Thank you.

 

Jae

 

0 Kudos
Message 1 of 3
(2,697 Views)

In this case there probably isn't much of a difference between the Globals and Shared Variables.  Even if you read the White Paper, "Using the LabVIEW Shared Variable" you will see that it says,

 

The underlying implementation of the single-process shared variable is similar to that of the LabVIEW global variable. The main advantage of single-process shared variables over traditional global variables is the ability to convert a single-process shared variable into a network-published shared variable that any node on a network can access.

 

http://www.ni.com/white-paper/4679/en/#toc2

 

The only reason I could think of in this particular example is that by enabling the real-time FIFO of a shared variable, you can share data without affecting the determinism of VIs runningon an RT target.

 

http://zone.ni.com/reference/en-XX/help/370622K-01/lvrtconcepts/passing_data_between_vis/

 

For the most part the UI Commands loop makes use of globals while the DAQ Control Loop which is running a timed loop utilizes shared variables.  To be honest, there might not be a good reason but I would be interested if someone knew one.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 3
(2,664 Views)

If there's a need to serialize your variable, the error line on the Shared Variable is your friend.

 

BS

0 Kudos
Message 3 of 3
(2,622 Views)