Support and Documentation

13.9 Advanced DIO Control

Overview

This page will discuss advanced features of the DIO that are available on T-Series devices.


Masked DIO Operations

Digital I/O "Bank" registers allow you to read or set the direction and state of multiple lines using a single operation. These registers function as bitmasks, where each bit in the written value corresponds to a specific I/O line (e.g., Bit 0 = DIO0, Bit 3 = DIO3).

Note: If a specific DIO line is not present on your device, its corresponding bit in the register is ignored.

Core Masked Registers

  • DIO_INHIBIT: A protection mask. When a bit is set (1) in this register, the corresponding bits in DIO_STATE and DIO_DIRECTION are "locked" and will be ignored during writes.

  • DIO_DIRECTION: Sets the line as an Input (0) or Output (1).

  • DIO_STATE: * Writes: Sets the output state (High/Low) for lines configured as Outputs.

    • Reads: Returns the current state of all lines.

  • Note: Unlike single-line registers, bank registers do not automatically switch set the direction of a line. You must explicitly set the direction.

Reading Behavior

When reading a line that is set to input, the voltage on the pin will be interpreted as a logic high or low.

When reading a line set to output the follow behaviors may be observed:

  • When reading the state of an output, the actual voltage, as measured behind the protection resistors (see the “Protection” section above), will be used to determine whether the line is logic high or low.

  • The voltage is read behind the protection resistors. This creates a voltage divider with the output circuitry. That divider causes the following behaviors:

    • An output-high will read HIGH even when the screw terminal is shorted to GND. Connecting a negative voltage may cause an output-high to read LOW.

    • A CIO or EIO line set to output-low will read HIGH when shorted to VS.

    • A FIO line set to output-low will read LOW when shorted to VS.

  • At this time is it not possible to read the latches that control whether the IO is attempting to drive high or low.


Examples

Isolating a Single Line (DIO8)

In this scenario, we want to modify DIO8 without risking accidental changes to any other pins.

  1. Protect other lines: Write 0xFFFFFEFF to DIO_INHIBIT. (This inhibits every bit except Bit 8).

  2. Set Direction: Write 0xFFFFFFFF to DIO_DIRECTION. Because of the Inhibit mask, only DIO8 changes to an output; all other lines are ignored.

  3. Set State: Write 0 to DIO_STATE. Only the 8th bit is acted upon, driving DIO8 Low.

Multi-Line Configuration (DIO0, 2, and 3)

We want to update a specific group of pins: DIO0, DIO2, and DIO3 (Binary 1101 or Hex 0x0D).

  1. Set Inhibit: Write 0xFFFFFFF2 to DIO_INHIBIT. This allows changes only to bits 0, 2, and 3.

  2. Set Direction: Write 13 (0x0D) to DIO_DIRECTION. This sets DIO0, 2, and 3 as outputs.

  3. Set States: Write 9 (0b1001) to DIO_STATE. This drives DIO0 and DIO3 High, while driving DIO2 Low.

Read the states of DIO0, 2 and 3

When reading the DIO_STATE register, you will receive a large integer representing all pins. To isolate the state of a specific pin, use either bitwise operators or basic arithmetic:

Target

Bitwise Implementation (Fastest)

Arithmetic Implementation

DIO0

(DIO_STATE >> 0) & 1

DIO_STATE % 2

DIO2

(DIO_STATE >> 2) & 1

(DIO_STATE / 4) % 2

DIO3

(DIO_STATE >> 3) & 1

(DIO_STATE / 8) % 2

Pull-ups and Pull-downs

Every digital I/O (DIO) line on T-Series devices includes internal resistors to ensure that inputs remain in a known state (High or Low) when not actively driven by an external signal. Without these, an unconnected input is "floating" and may toggle randomly.

Types

Due to differences in how the hardware is implemented, the electrical behavior of the pull-up or pull-down varies. Below is list of types and the

Because hardware implementation varies by device and pin, the electrical behavior of these resistors differs:

  • Simple (Fixed): These resistors are 100 kΩ, always active, and cannot be disabled in software.

  • Switched Flex Lines (Controllable): These are ≈17.5 kΩ and are connected to 2.2 V. They default on and can be disabled via software.

  • Switched Pull-Up (Controllable): These are ≈5 kΩ, default on, and can be disabled via software.

  • Switched Pull-Down (Controllable): These are ≈94 kΩ, default off, and can be enabled via software.

Device Compatibility & Specifications

The following table outlines the resistor configurations in each device:

Device

DIO Lines

Pull-up Type

Pull-Down Type

T7 (All Variants)

DIO[0:22]

Simple (Fixed)

None

T4

DIO[4:11]

Switched Flex Lines

None


DIO[12:19]

Simple (Fixed)

None

T8

DIO[0:19]

Switched Pull-Up

Switched Pull-Down

Technical Notes

  • Fixed Pull-Ups (100 kΩ): These are connected to 3.3 V and are always active. Note that on some lines, the lower voltage may cause small loads to pull the line low enough that it fails to register as a High state.

  • Flex Line Pull-Ups (≈17.5 kΩ): These are connected to 2.2 V. They can be switched off to prevent interference with sensitive analog signals. See Section 13.1 for instructions on toggling these via software.

  • Switched Pull-Up: These have a 5 kΩ pull-up which defaults ON and can be disabled.

  • Switched Pull-Down: These have a 94 kΩ pull-down which defaults OFF and can be enabled.

  • Measurement Method: All impedance values were determined by creating a voltage divider using a 22 kΩ reference resistor to either GND (for pull-ups) or 3.3 V (for pull-downs).


Boot-up Defaults

The states and directions of that the IO lines will be set to during boot-up can be configured see 24.0 Device Configuration for more information.