This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Reading the Value of Analog or Digital Output Channels in LabVIEW and LabWindows™/CVI

Updated Sep 27, 2024

Reported In

Software

  • LabVIEW
  • LabWindows/CVI

Issue Details

In my application I am writing some values out on an analog or digital output line. How do I read the value being output on the line without having to manually connect wires from the output channel back to an input channel?

Solution

The technique used to accomplish this task differs depending on whether the output of interest is analog or digital. 

Reading Back Analog Output

LabVIEW

While you cannot read this channel with the default settings for a DAQmx Physical Channel, you can read the Analog Output in relation to the Analog Output Ground by enabling the selection of Internal Channels:


  1. Place a DAQmx Physical Channel Control/Constant in your program. (All Controls»I/O»DAQmx Name Controls»DAQmx Physical Channel)
  2. Right click on the Constant and click I/O Name Filtering...
  3. In the window that opens make sure to select Internal Channels and click OK.
  4. Now select the channel _aoX_vs_aognd where X is the desired output channel.

You are now able to select any of these internal channels as a voltage that you are able to read. You can also select the various other physical channels that you want to read by clicking Browse and selecting the desired lines.

The following screenshot illustrates provides an example of monitoring a continuous analog output.  The code is a modification of a DAQmx shipping example for analog generation designed to also read the output. 

 

LabWindows/CVI


 
  1. In a source (.c) file, type the function and then right-click on the text, and select Recall Function Panel.
  2. In the function panel, click the ”” button next to the text box beneath Physical Channel, and select Filter…
  3. In the Filter Settings dialogue that pops up, select Internal Channels and click OK.
  4. Now select the channel _aoX_vs_aognd where X is the desired output channel.

 

Reading Back Digital Output

LabVIEW

With digital I/O lines, you can use a DAQmx Read to read the value back from the same output channel without having to internally route signals. The following VI Snippet illustrates how to accomplish this:




 

LabWindows/CVI

The same operation programming flow shown above for LabVIEW can be used in LabWindows/CVI when using digital lines. You can simply call a DAQmxRead function on a digital output channel to read the current line state.