Example Code

Write a Digital Waveform With a Specific Pulse Width and Digital High/Low Pattern

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
The example demonstrates how to generate digital waveform defined by the High-Low pattern control and counter as the width manipulator of the signal (both Single and Multi works the same)

Description:
To specify the pattern of the digital waveform, you must create a boolean array and convert it to a digital waveform using the DWDT Boolean Array To Digital.VI This array will specify the high and low pattern of the digital waveform. The number of columns in the boolean array will correspond to the number of lines that you are outputting on. Instead of using the internal timebase, use a counter output pulse train as the timing source for the waveform, and this will specify the pulse width of the digital waveform depending on the frequency of the counter pulse train.
Attached are VIs that will permit one to generate a digital waveform on one line and generate a digital waveform on two lines.  The block diagrams of each are exactly the same.

The key difference lies within the controls on the front pannel.  Notice in the One_Dig_Wvfrm_Write.vi, there is only one Digital Output Line; whereas, in the Mult_Dig_Wvfrm_Write.vi, there are two Digital Output Lines selected.  Each column in the Digital High/Low Pattern control corresponds to an individual digital output line.

Steps to implement or execute code
To implement this example:
  1. Define the physical channels to be used
  2. (Optional) Set the rest of the parameters as needed
  3. Run the VI
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI


To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the DIO and Counter features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

Hardware
cDAQ with C series Digital IO and Counter Module

 

fpm.JPG

 

bdm.JPG

 

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

Sara Lewandroski
Applications Engineer | National Instruments

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