Example Code

Generate DC Voltage - Software Update

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview:
Demonstrates how to output a single voltage sample from an Analog Output Channel.

Description:
Increment, Minimum and Maximum Values and Physical Channel are used to configure the  DAQmx Create Channel  (AO Voltage) to create a channel to generate the voltage.
By wiring the controls to the Voltage Output property node, those values will be settable during runtime.  
Analog DBL 1Chan 1Samp function writes a floating-point sample to a task that contains a single analog output channel and by specifying the timeout input, NI-DAQmx performs a timeout check before writing data.
If the time has elapsed and the VI could not write all submitted samples, it returns an error and the number of samples successfully written per output channel.
If the timeout value is set to 0, the VI tries once to write the submitted samples. You may also set the timeout to -1 to make the VI waits indefinitely.
The loop will stop if there is any error occurs or when the user clicks on Stop Button. The task will then be cleared when it is passed to DAQmx Clear Task.
This VI also will abort the task, if necessary, and releases any resources the task reserved.

Requirement:
LabVIEW 2012 or compatible.
NI-DAQmx 15.5.1 or compatible.

Steps to Implement or Execute Code:

  1. Select the Physical Channel to correspond to where your signal is output on the DAQ device. Make sure your signal output terminal matches the Physical Channel I/O Control. For further connection information, refer to your hardware reference manual.
  2. Enter the Minimum and Maximum Voltage Ranges.
    Note:  Use the Acq One Sample example to verify you are generating the correct output on the DAQ device.

Front Panel.PNG

 

2017-05-12_11-21-53.jpg

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Regards,
Dan King

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.