Support and Documentation

13.0 Digital I/O [T-Series Datasheet]

Overview

All LabJack T-series devices come with Digital Input/Output (DIO) lines. These versatile pins have many uses. This page covers the essential naming conventions, basic software commands, and the hardware details required for most applications.

For a list of the Digital IO available on each device see the tables here: 4.0 Hardware Overview

For more detail or advanced operation see these links:

  • For Hardware Specs: If you need detailed electrical data, such as input impedance or voltage thresholds, see A-2 Digital I/O.

  • For Advanced Features: If you are looking for information on updating the DIO in groups, configuring the Pull-ups, or setting the boot-up defaults visit the Advanced DIO & Configuration page.

  • Serial Communication: Interfacing with other digital logic circuits, sensors, and microcontrollers via SPI, I2C, Asynchronous Serial, and 1-Wire.

  • Measuring & Generating Signals: Output PWM with Phase Control and the ability to output a specific number of pulses. Measure frequency, dutycycle, and quadrature decoding. These are all part of Digital IO Extended Feature (DIO_EF) suite: 12.2 DIO Extended Features

  • Sensirion SHT/SBUS : Special support for Sensirion digital humidity and temperature sensors.

  • Stream: For faster data rates, the states of the DIO can be read using stream. And the DIO can updated using stream_out.

  • Controlling Hardware: Activating relays or solenoids.


Operation

Naming Conventions (FIO vs DIO)

Each digital I/O terminal has two names: a Bank Name and a Simple Name. Originally, bank names described specific hardware capabilities. As our devices have evolved, the features have expanded beyond the limit of the Bank terminology. To simplify future designs, new devices will be labeled using only "DIO#".

Whether your device is labeled FIO, EIO, CIO, or MIO, they all belong to the same Digital I/O (DIO) family. In software, most pins can be addressed by either label (e.g., "FIO4") or their universal index (e.g., "DIO4").

Note: Some advanced functions, such as Digital IO Extended Features, require the use of the Simple Name (DIO#).

Logic Levels

T-Series devices use 3.3V Logic.

  • When set to output, the IO will be driven to 0 or 3.3V.

  • When set to input, if the voltage is below the low threshold (typically 0.9 V) the IO will report 0. If the voltage is above the high threshold (typically 2.1 V) the IO will report 1. See the specifications for the actual thresholds for each device.

5V Tolerance: All T-Series DIO are 5V Tolerant. You can safely input a 5V signal without damaging the device.

If your application requires interfacing with larger voltages, like 24V industrial signals or 5V logic chips that require a full 5V swing, see here


Read and Writing

Each IO line can be configured to be input or output. When set to output they can be set to drive to logic high or logic low. T-Series devices simplify the use of DIO by removing the need for an explicit direction command. Instead, the device will automatically set the direction according to these rules:

  • When a register which accesses one DIO (eg: FIO4, DIO7, etc.) is written to, that line will be set to output.

  • When a register which accesses one DIO is read, that line will be set to input.

Writing to a Single DIO Line

To set the output state of a digital IO line, simple write 0 or 1 to the corresponding register.

Reading from a Single DIO Line

To read the state of a digital IO line, read from the corresponding register.

Read from an output

When using a register which access one DIO which is set to output, the line will be set to input and the state will be read very quickly ( 1 µs). This is often too fast for the actual state of the line to change. To ensure an accurate reading, the line should be reread a few milliseconds after the direction has been changed.

DIO Registers


Examples

Set FIO2/DIO2 to Output High

To drive the line high (3.3V), write a value of 1 to the FIO2 or DIO2 register:

// Example using the C# Wrapper (Only one of the two following lines are needed)
LJM.eWriteName(handle, "FIO2", 1); 
LJM.eWriteName(handle, "DIO2", 1);

Result: The specified line is automatically configured as an output and driven to a high state (3.3V).

Read the State of a FIO3/DIO3

To read the state of the FIO3 or DIO3 register, use the eReadName or eReadName function.

// Example using the C# Wrapper. (Only one of the two following lines are needed)
LJM.eReadName(handle, "FIO3", ref io_state);
LJM.eReadName(handle, "DIO3", ref io_state);

Important Considerations:

  • Automatic Direction Switching: Calling a read function on these lines will automatically set the line to input.

  • Voltage Settling: Because the switch to input happens almost instantaneously, an initial read may reflect the line's previous "output" voltage rather than its new state (which may be driven by an external circuit or internal pull-ups).

  • Best Practice: When switching a line from output to input, take a second reading a few milliseconds after the first. This ensures the voltage has fully settled and the value is accurate.

Troubleshooting

DIO Changed State Automatically

As described in Electrical Overview above, digital I/O on T-series devices are tri-state and thus have 3 possible states: input, output-high, or output-low.  The DIO stay in their current state until told to go to some different state.  There are various ways they could be told to go to a different state:

  • Some software sends a command telling a DIO to go to a different state.

  • Your Lua script running on the device tells a DIO to go to a different state.

  • The watchdog tells DIO to go to a different state.

  • The T7 reboots causing the DIO to go to the saved power-up condition.

Unexpected Voltage On IO Terminals

If a DIO terminal is at about 3.3 volts, and you are not sure if it is set to input or output-high, a couple ways to tell are:

Look for a slight change on a terminal with nothing connected except a DMM. For example, a DMM measurement of an input might show 3.30V whereas that same terminal as output-high reads 3.31V.

Add a load resistor. If you add a 100k from FIO7 to GND, the terminal should measure about 1.6V for input and 3.3V for output-high.

See Appendix A-2 for more details.