From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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

Synchronize Correlated Digital Output with Analog Input Using NI-DAQmx

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 uses DAQmx to synchronize finite generation and acquisition of Correlated Digital Output with an Analog Input Task respectively.

Descriptions:
Correlated I/O enables synchronization of on board digital I/O lines to a clock reference. Digital and Analog samples can be synchronized in time by sharing the AI clock as the source of your digital I/O clock. You may also use the Counter Output pulse as the Source of Digital Timing. Hence, set the Source for Digital Timing as ai/SampleClock.This  example will work on any device that uses DAQmx and supports Correlated  Digital I/O. To perform Correlated Digital I/O on 9172 Chassis,  you need a Correlated Module in slot 1-4 of the chassis.

Requirements:
  1. LabVIEW 2012 or compatible.
  2. NI-DAQmx 15.5.1 or compatible.


Steps to Implement or Execute Code:

  1. Set all the control values on the front panel corresponding to the physical channel to be used on the DAQ device.
  2. Run this VI.
  3. Monitor the analog input voltage measured and ramp signal generated from specified channels.


Block Diagram Steps:

  1. Creates channels to measure voltage and to generate digital signals  
  2. Sets the source of the Sample Clock, the rate of the Sample Clock, and the number of samples to acquire or generate.
  3. Generates an array containing a ramp pattern and write to digital output lines.
  4. Transitions the tasks to running state to begin measuring and generating data.
  5. Reads the waveform from the analog input channel and waits for the digital output generation to complete.
  6. Clears the tasks.
  7. Displays any error occurs.

Front Panel.PNG

 

Block Diagram.PNG

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

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

Comments
by_182
Member
Member
on

This file why it can not be used on hardware usb-6009?

by_182
Member
Member
on

This file why it can not be used on hardware usb-6009?

Error -200077 occurred at Property Node DAQmx Timing (arg 1) in DAQmx Timing (Sample Clock).vi:4730001->Correlated Finite DO with AI.vi

Possible reason(s):

Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.

Property: SampTimingType

Requested Value: Sample Clock

Possible Values: On Demand

Task Name: _unnamedTask<0>

crossrulz
Knight of NI Knight of NI
Knight of NI
on

Because the USB-6009 does not have hardware timed DIO, only software timed DIO.  Meaning it cannot output digital waveforms as this example is doing.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
by_182
Member
Member
on

(Bahasa)

Terimakasih atas jawabnya.

selanjutnya, apa yang harus dilakukan agar program tersebut dapat berjalan

pada USB-6009? apakah tidak bisa?

(English)

Thank you for your answer

*Furthermore, what should be done so that the program can run on USB-6009?

would it not be?*

2016-06-01 23:09 GMT+07:00 crossrulz <web.community@ni.com>:

NI Community <https://decibel.ni.com/content/index.jspa>

Correlated Digital Output with Analog Input Task in DAQmx (Finite) new

comment by crossrulz <https://decibel.ni.com/content/people/crossrulz> View

all comments on this document

<https://decibel.ni.com/content/docs/DOC-10751#comment-49445>

crossrulz
Knight of NI Knight of NI
Knight of NI
on

by_182 wrote:

*Furthermore, what should be done so that the program can run on USB-6009?

would it not be?*


                   

The USB-6009 simply does not have the capability to run this code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
by_182
Member
Member
on

what can I obtain a compatible file for usb-6009? please help me

I will use an analog as an input and digital as ouput.

2016-06-02 17:06 GMT+07:00 crossrulz <web.community@ni.com>:

NI Community <https://decibel.ni.com/content/index.jspa>

Correlated Digital Output with Analog Input Task in DAQmx (Finite) new

comment by crossrulz <https://decibel.ni.com/content/people/crossrulz> View

all comments on this document

<https://decibel.ni.com/content/docs/DOC-10751#comment-49475>

TaoCui
Member
Member
on

I have a question regarding this example.

I have a slower digital module, for example NI9422 250us response time. I have a faster analog module, for example NI9220 10us sample interval. If I correlate NI9422 to NI9220, I can run the sampling program at the highest 10us interval. Then, what does this mean for digital module? Does its result get interpolated?