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

Software and Hardware Trigger Digital Output Lines

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:
Software Trigger Digital Output Lines demonstrates on configuring Digital Output channel to generate a finite pulse train upon receiving trigger. Hardware Trigger Digital Output Lines demonstrates on retriggering digital signal from Digital Output lines by using external trigger. 

Description:
For the software trigger VI, trigger signal is from the Boolean control on the front panel. Each time the user clicks on the Retrigger? control, the device perform a finite generation until the task is stopped.
This example was designed with a PCIe-6321 and a BNC-2120.  It lights up each of the Digital I/O LEDs in Port 0 sequentially.  The pattern starts on a digital edge start trigger.

For the hardware trigger VI, When this VI runs, it waits for a digital trigger signal received at the Trigger Source. Once the digital signal with specified Trigger Edge is received, it will begin to write data to the Digital Output Lines. The DAQmx Is Task Done VI is place in a while loop to continuously query the status of the task. Once the task is completed, it will stop the loop, clear the task and wait for another start trigger.


Note: The following code was written and tested on a PCI-6534. Since retriggering isn't supported in the hardware, it can be done through software. After the digital lines generation is completed, stop the DAQmx task and restart it. This will re-arm the task's start trigger which will then wait for the next digital edge.

 

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

Steps to Implement or Execute Code:

Software Trigger:

  1. Sets all control values on the front panel.
  2. Run this VI.

Hardware Trigger:

  1. Set the control value on the front panel corresponding to the digital lines at which data will be output, the trigger source at which terminal digital pulse is received which allow digital output line to begin generation and other necessary values.
  2. Run this VI.

SW - block Diagram.PNG

 

HW - Block Diagram.PNG

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

Systems Engineer
SISU

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