« Close

Datasheets and User Guides

App Notes

Software & Driver

 

13.0 Digital I/O

DIO Overview

Digital I/O: 23

Logic Level: 3.3V

DIO is a generic name used for all digital I/O.  The DIO are subdivided into different ports called FIO, EIO, CIO, and MIO. For wiring information on open-collector signals, driven signals, controlling relays, and mechanical switches, see the digital signals app note.

 

Table 13-1. DIO Mapping

  FIO (0-7)  EIO (0-7) CIO (0-3) MIO (0-2)
DIO 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
                                               

There are 4 types of registers used for digital I/O interaction: Simple DIO#, DIO State, DIO Direction, and DIO Inhibit

Register Listings

Read or set the state of 1 digital I/O. Automatically configures the direction to input (when reading) or to output (when writing).

FIO0-FIO7 = DIO0-DIO7
EIO0-EIO7 = DIO8-DIO15 
CIO0-CIO3 = DIO16-DIO19
MIO0-MIO2 = DIO20-DIO22

Digital I/O
Name Start Address Type Access
FIO#(0:7) 2000 UINT16 R/W
EIO#(0:7) 2008 UINT16 R/W
CIO#(0:3) 2016 UINT16 R/W
MIO#(0:2) 2020 UINT16 R/W
FIO#(0:7)
- Starting Address: 2000
Read or set the state of 1 bit of digital I/O. Also configures the direction to input or output. Read 0=Low AND 1=High. Write 0=Low AND 1=High.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
Expanded Names Addresses
FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7 Show All 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Show All
EIO#(0:7)
- Starting Address: 2008
Read or set the state of 1 bit of digital I/O. Also configures the direction to input or output. Read 0=Low AND 1=High. Write 0=Low AND 1=High.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
Expanded Names Addresses
EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7 Show All 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Show All
CIO#(0:3)
- Starting Address: 2016
Read or set the state of 1 bit of digital I/O. Also configures the direction to input or output. Read 0=Low AND 1=High. Write 0=Low AND 1=High.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
Expanded Names Addresses
CIO0, CIO1, CIO2, CIO3 Show All 2016, 2017, 2018, 2019 Show All
MIO#(0:2)
- Starting Address: 2020
Read or set the state of 1 bit of digital I/O. Also configures the direction to input or output. Read 0=Low AND 1=High. Write 0=Low AND 1=High.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
Expanded Names Addresses
MIO0, MIO1, MIO2 2020, 2021, 2022

Digital I/O State Bit Masks

Each of these is a single binary-encoded value representing the state of 8 bits of I/O. Each bit represents an I/O line. Does not configure direction. A read of an output returns the current logic level on the terminal, not necessarily the output state written. The upper 8-bits of these values are inhibits. The inhibit bits prevent the corresponding state bit from being modified.

State Bit Masks
Name Start Address Type Access
FIO_STATE 2500 UINT16 R/W
EIO_STATE 2501 UINT16 R/W
CIO_STATE 2502 UINT16 R/W
MIO_STATE 2503 UINT16 R/W
FIO_STATE
- Address: 2500
Read or write the state of the 8 bits of FIO in a single binary-encoded value. 0=Low AND 1=High. Does not configure direction. A read of an output returns the current logic level on the terminal, not necessarily the output state written. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • This register may be streamed
  • Minimum firmware version: 1.0000
EIO_STATE
- Address: 2501
Read or write the state of the 8 bits of EIO in a single binary-encoded value. 0=Low AND 1=High. Does not configure direction. A read of an output returns the current logic level on the terminal, not necessarily the output state written. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • This register may be streamed
  • Minimum firmware version: 1.0000
CIO_STATE
- Address: 2502
Read or write the state of the 4 bits of CIO in a single binary-encoded value. 0=Low AND 1=High. Does not configure direction. A read of an output returns the current logic level on the terminal, not necessarily the output state written. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • This register may be streamed
  • Minimum firmware version: 1.0000
MIO_STATE
- Address: 2503
Read or write the state of the 3 bits of MIO in a single binary-encoded value. 0=Low AND 1=High. Does not configure direction. A read of an output returns the current logic level on the terminal, not necessarily the output state written. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • This register may be streamed
  • Minimum firmware version: 1.0000

For example:  To read the digital state of all FIO lines in a bit mask, read FIO_STATE.  The value will be something like 0b11111011 representing 1 for logic high, and 0 for logic low. FIO2 is currently logic low. 

Digital I/O Direction Bit Masks

Each of these is a single binary-encoded value representing the direction of 8 bits of I/O. Each bit designates an I/O line. 0=Input and 1=Output. The upper 8-bits of this value are inhibits. The inhibit bits prevent the corresponding direction bit from being modified.

Direction Bit Masks
Name Start Address Type Access
FIO_DIRECTION 2600 UINT16 R/W
EIO_DIRECTION 2601 UINT16 R/W
CIO_DIRECTION 2602 UINT16 R/W
MIO_DIRECTION 2603 UINT16 R/W
FIO_DIRECTION
- Address: 2600
Read or write the direction of the 8 bits of FIO in a single binary-encoded value. 0=Input and 1=Output. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Minimum firmware version: 0.9402
EIO_DIRECTION
- Address: 2601
Read or write the direction of the 8 bits of EIO in a single binary-encoded value. 0=Input and 1=Output. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Minimum firmware version: 0.9402
CIO_DIRECTION
- Address: 2602
Read or write the direction of the 4 bits of CIO in a single binary-encoded value. 0=Input and 1=Output. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Minimum firmware version: 0.9402
MIO_DIRECTION
- Address: 2603
Read or write the direction of the 3 bits of MIO in a single binary-encoded value. 0=Input and 1=Output. The upper 8-bits of this value are inhibits.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Minimum firmware version: 0.9402

For example:  To set FIO1-7 to output, write a value of 0x01FF to FIO_DIRECTION. FIO0 is the least significant bit, so to prevent modification the corresponding inhibit bit is set with 0x01 in the most significant byte. The least significant byte is 0xFF, which is all 8 bits of FIO set to output.

Alternative DIO Registers

The DIO registers are the same thing as EIO, FIO, CIO, and MIO but with a more intuitive naming scheme, and a more compact register allotment.

Electrical Overview

All digital I/O on the T7 have 3 possible states: input, output-high, or output-low. Each bit of I/O can be configured individually. When configured as an input, a bit has a ~100 kΩ pull-up resistor to 3.3 volts (all digital I/O are at least 5 volt tolerant). When configured as output-high, a bit is connected to the internal 3.3 volt supply (through a series resistor). When configured as output-low, a bit is connected to GND (through a series resistor).

See Appendix A for more details.

By default, the DIO lines are digital I/O, but they can also be configured as PWM Output, Quadrature Input, Counters, etc (see Extended Feature section of this Datasheet).

FIO vs. EIO vs. CIO vs. MIO

DIO is a generic name used for all digital I/O.  The DIO are subdivided into different groups called FIO, EIO, CIO, and MIO.

Sometimes these are referred to as different "ports".  For example, FIO is an 8-bit port of digital I/O and EIO is a different 8-bit port of digital I/O.  The different names (FIO vs. EIO vs. CIO vs. MIO) have little meaning, and generally you can call these all DIO0-DIO22 and consider them all the same.  There are a couple details unique to different ports:

  • The source impedance of an FIO line is about 550 ohms, whereas the source impedance of EIO/CIO/MIO lines is about 180 ohms.  Source impedance might be important when sourcing or sinking substantial currents, such as when controlling relays.
  • The MIO lines are automatically controlled when using analog input channel numbers from 16 to 127.  This is for controlling external multiplexers or the Mux80 expansion board.

Power-up Defaults

The default condition of the digital I/O can be configured by the user. From the factory, all digital I/O are configured as inputs by default. Note that even if the default for a line is changed to output-high or output-low, there could be a small time (milliseconds) during boot-up where all digital I/O are in the factory default condition.  For more information see this forum topic.

Protection

All the digital I/O include an internal series resistor that provides overvoltage/short-circuit protection. These series resistors also limit the ability of these lines to sink or source current. Refer to the Digital I/O Specifications.

The fact that the digital I/O are specified as 5-volt tolerant means that 5 volts can be connected to a digital input without problems (see the actual limits in the specifications in Appendix A).

Increase logic level to 5V

In some cases, an open-collector style output can be used to get a 5V signal.  To get a low set the line to output-low, and to get a high set the line to input.  When the line is set to input, the voltage on the line is determined by a pull-up resistor.  The T7 has an internal ~100k resistor to 3.3V, but an external resistor can be added to a different voltage.  Whether this will work depends on how much current the load is going to draw and what the required logic thresholds are. Say for example a 10k resistor is added from EIO0 to VS. EIO0 has an internal 100k pull-up to 3.3 volts and a series output resistance of about 180 ohms. Assume the load draws just a few microamps or less and thus is negligible. When EIO0 is set to input, there will be 100k to 3.3 volts in parallel with 10k to 5 volts, and thus the line will sit at about 4.85 volts. When the line is set to output-low, there will be 180 ohms in series with the 10k, so the line will be pulled down to about 0.1 volts.

The surefire way to get 5 volts from a digital output is to add a simple logic buffer IC that is powered by 5 volts and recognizes 3.3 volts as a high input. Consider the CD74ACT541E from TI (or the inverting CD74ACT540E). All that is needed is a few wires to bring VS, GND, and the signal from the LabJack to the chip. This chip can level shift up to eight 0/3.3 volt signals to 0/5 volt signals and provides high output drive current (+/-24 mA).

We sell the LJTick-DigitalOut5V that converts our 3.3V outputs to 5V outputs.

Note: DAC0, DAC1 channels on the T7 can be set to 5 volts, providing 2 output lines with such capability.