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

Dynamic Digital Output Custom Waveform With C#

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

  • Other

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview
The project would shows how to program a dynamic digital output of waveform signal

Description:
This example demonstrates how to output a finite, custom digital waveform using an internal clock.

Steps to implement or execute code
To implement this example:
  1. Select the Physical Channel to correspond to where your signal is output on the DAQ device.
  2. Specify the Rate of the output digital pattern


Steps in the Code:

  1. Create a new task.
  2. Create the digital output channel.
  3. Configure the task to use an internal sample clock
  4. Set the sample mode for finite samples.
  5. Create a DigitalMultiChannelWriter and associate it with the task by using the task's stream.
  6. Call the DigitalMultiChannelWriter.WriteWaveform method to write the digital pattern to a buffer.
  7. Call Task.Start().
  8. Dispose the Task object to clean-up any resources associated with the task.
  9. Handle any DaqExceptions, if they occur.

Requirements
Software
Visual Studio 2010
.NET Framework 4.0
NI-DAQmx 16.0 or compatible

Hardware
NI PXIe/PCIe-6535/6536/6537

result.png

 

 Additional Notes:


Digital Waveform Graph has Different Line Ordering for NI PXIe/PCIe-6535/6536/6537 Devices

 

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

Mikhail
RF Toolkits, Product Support Engineer
National Instruments

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