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

DAQmx Digital I/O: Toggling Tristate on Individual Lines in the Same Port

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 VI allows for the user to individually toggle the output of 8 lines of the same port between HIGH, LOW, and FLOAT (Tristate).

Description

Tristate outputs have three states, as the name implies. The states are LOW, HIGH and FLOAT. Floating the tristate output is also referred to as tristating or going into a high-impedance state. Tristate devices are very useful when you want to allow more than one device to drive the same signal, but you want to ensure that only one device is driving the signal at any time.

This example uses the DAQmx Channel property node to select a channel and toggle its Tristate status. This is iterated for the number of lines in the array of channel names provided to the for loop.

Requirements

Software:

  • LabVIEW 2010 or compatible
  • DAQmx 9.1.5 or compatible

Hardware:

Steps to Implement or Execute Code

  1. Wire together the lines of two different ports. One will perform Digital Writes and the other will perform Digital Reads.
  2. Set lines for Write and Read. This example was developed to manipulate 8 lines. Fewer can be used without modification.
  3. The Digital Write to Lines buttons work as normal boolean toggles.
  4. The Tristate Toggles enable/disable the FLOAT (Tristate) output to each line.

Additional Information or References

Tristate DIO Line-by-Line (software timed) - FRONT PANEL.png

Tristate DIO Line-by-Line (software timed).png

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

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

Contributors