« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.8 - Digital I/O

Digital I/O Overview

The LabJack U6 has 20 digital I/O. The LabJackUD driver uses the following bit numbers to specify all the digital lines:

0-7    FIO0-FIO7
8-15   EIO0-EIO7
16-19  CIO0-CIO3
20-22  MIO0-MIO2

Note:  On the U6/U6-Pro the digital lines CIO0-2 and MIO0-2 are shared. This means that changing the state of MIO0-2 will also change the state of CIO0-2. Therefore, anyone using two accessory boards with a U6 needs to be aware that they can use either CIO0-2 or MIO0-2, but cannot use both simultaneously.  MIO0-2 are used to control extended analog channels, so if you are reading extended channels from the Mux80 you do not want to use slots 8-10 on the RB12 (only use slots 0-7 & 11).

The U6 has 8 FIO (flexible digital I/O). The first 4 lines, FIO0-FIO3, appear both on the screw terminals and on the DB37 connector. The upper 4 lines appear only on the DB37 connector. By default, the FIO lines are digital I/O, but they can also be configured as up to 4 timers and 2 counters (see Timers/Counters Section of this User’s Guide).

The 8 EIO and 4 CIO lines appear only on the DB15 connector. See the DB15 Section of this User’s Guide for more information.

Up to 6 of the FIO/EIO lines can be configured as timers and counters. These are enabled sequential starting from FIO0-EIO0 (determined by pin offset). Thus, any sequential block of 1-6 digital I/O, starting from FIO0 to EIO0, can be configured as up to 4 timers and up to 2 counters.

MIO are standard digital I/O that also have a special multiplexer control function described in Section 2.6 above (AIN). The MIO are addressed as digital I/O bits 20-22 by the Windows driver. The MIO hardware (electrical specifications) is the same as the EIO/CIO hardware.

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 specifications in Appendix A.

All digital I/O on the U6 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 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).

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). If 5 volts is needed from a digital output, consider the following solutions:

  • 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 U6 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).
  • Note that the 2 DAC channels on the U6 can be set to 5 volts, providing 2 output lines with such capability.

 

The power-up condition of the digital I/O can be configured by the user with the "Config Defaults" option in LJControlPanel.  From the factory, all digital I/O are configured to power-up as inputs. Note that even if the power-up default for a line is changed to output-high or output-low, there is a delay of about 100 ms at power-up where all digital I/O are in the factory default condition.  For more information see this forum topic.

If you want a floating digital input to read low, an external pull-down resistor can be added to overpower the internal 100k pull-up.  4.7k to 22k would be a typical range for this pull-down, with 10k being a solid choice for most applications.

The low-level Feedback function (Section 5.2.5) writes and reads all digital I/O. See Section 3.1 for timing information. For information about using the digital I/O under the Windows LabJackUD driver, see Section 4.3.5.

Binary Encoded Values

Many function parameters contain specific bits within a single integer parameter to write/read specific information. In particular, most digital I/O parameters contain the information for each bit of I/O in one integer, where each bit of I/O corresponds to the same bit in the parameter (e.g. the direction of FIO0 is set in bit 0 of parameter FIODir). For instance, in the function ControlConfig, the parameter FIODir is a single byte (8 bits) that writes/reads the power-up direction of each of the 8 FIO lines:

  • if FIODir is 0, all FIO lines are input
  • if FIODir is 1 (20), FIO0 is output, FIO1-FIO7 are input,
  • if FIODir is 5 (20 + 22), FIO0 and FIO2 are output, all other FIO lines are input,
  • if FIODir is 255 (20 + … + 27), FIO0-FIO7 are output.

Duplicated Terminals (FIO0-FIO3)

FIO0-FIO3 appear on the built-in screw-terminals and also on the DB37 connector.  You should only connect to one or the other, not both at the same time.

To prevent damage due to accidental short circuit, both connection paths have their own series resistor.  All FIO lines have a 470 ohm series resistor (that is included in the 550 ohm total impedance), and in the case of FIO0-FIO3 the duplicated connections each have their own series resistor, so if you measure the resistance between the duplicate terminals you will see about 940 ohms.

 

5 comments

Hello! when the Lab Jack U6 is connected to PC, the digital ports are setted to High. Is it possible to change this? I mean I want to connect the Lab Jack to USB and the digital ports should be set to Low, like the U12 card.

Yes! You can set the initial states of the digital IO. Just fire up LJControlPanel and click the Config IO Defaults button.

wow! thank you :) it works fine!

I would like to send 5V digital outputs from the LabJack U6 to a DB9 trigger-in port on an actiChamp EEG system. What specifically do I need in order to increase the voltage on my FIO outputs to 5V?

There are 3 related bullets above.  The 2nd is sure-fire.  The 3rd is sure-fire using the 2 DAC outputs.  The 1st works in most situations ... unless your load needs lots of current.  Beyond those, we have a new product that has not been released yet called the LJTick-DigitalOut5V which is basically an op-amp with gain=1.5.  Contact [email protected] if you want more info about that.