Binding NI-DAQmx™ Strain Task Data to Shared Variables

Updated May 20, 2024

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

I am following the Using the LabVIEW Network-Published Shared Variable and OPC With NI-DAQmx™ with the goal of reading my DAQmx strain data on an OPC client. The tutorial proposes two possible solutions, including binding to both local (project) and global (NI MAX) NI-DAQmx Virtual Channels with shared variables. However, when following the tutorial I found that I was unable to set certain attributes of my acquisition such as timing and sample clock source due to those properties being DAQmx task properties and not channel properties. How can I get my DAQmx task data to my OPC client? 

Solution

Because DAQmx timing configuration settings such as sample rate and sample clock are DAQmx task properties and not channel properties, a more traditional method has to be used to publish your acquired data to a shared variable. In LabVIEW, you can use a DAQmx example program that acquires analog strain data as a starting point and from there simply write your data received by the DAQmx Read VI to a network published shared variable. Once a Shared Variable has been created using the Network-Published scope, all data written to the variable is available to all systems networked with the host computer, including a OPC quick client. 

For more information, refer to section 3 of Using the LabVIEW Shared Variable.
 

Additional Information

NI-DAQmx uses NI-PSP to interact with the Shared Variable Engine and make data read by the driver available to all networked devices. NI-DAQmx automatically produces PSP objects for all NI-DAQmx global virtual channels configured in MAX and all NI-DAQmx local channels created in LabVIEW, though it does not publish data from NI-DAQmx tasks.