From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Synchronized AI AO with Dynamic Clock Using LabVIEW and DAQ

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

This example dynamically updates the sample rate of the analog input and output tasks through the use of an external clock source.


Description
 The external clock source, in this case, is an onboard counter. A possible modification of the code would be to fix the Samples to Read input of the DAQmx Read to 1/10th of the sample rate in order to simplify the UI and reduce the chance of buffer overflow and timeout errors. For quick testing specify, Using AI0 as your input physical channel, AO0 as your output physical channel and Ctr0 as your Clock.

 


Requirements

  • LabVIEW 2012 (or compatible)
  • NI-DAQ 12.0 (or compatible)


Steps to Implement or Execute Code

  • Select the device or physical Channels you pick.
  • Enter the sample parameters such as minimum and maximum value and sample rate.
  • Run the program

 

Additional Information or References
VI Snippet

2-262.png

**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.

Comments
donkdonk
Member
Member
on

Thanks a lot.

Just what I needed.

(Haven't tried it yet, but I will!)