Skip to Navigation

2.5 - Flexible I/O (FIO/EIO)

The FIO and EIO ports on the LabJack U3 can be individually configured as digital input, digital output, or analog input. This is FIO0-EIO7 on the U3-LV (16 lines), or FIO4-EIO7 on the U3-HV (12 lines). In addition, up to 2 of these lines can be configured as timers, and up to 2 of these lines can be configured as counters. If a line is configured as analog, it is called AINx according to the following table:

On the U3-HV, compared to the -LV, the first four flexible I/O are fixed as analog inputs (AIN0-AIN3) with a nominal ±10 volt input range. All digital operations, including analog/digital configuration, are ignored on these 4 fixed analog inputs.

Timers and counters can appear on various pins, but other I/O lines never move. For example, Timer1 can appear anywhere from FIO4 to EIO1, depending on TimerCounterPinOffset and whether Timer0 is enabled. On the other hand, FIO5 (for example), is always on the screw terminal labeled FIO5, and AIN5 (if enabled) is always on that same screw terminal.

The first 8 flexible I/O lines (FIO0-FIO7) appear on built-in screw terminals. The other 8 flexible I/O lines (EIO0-EIO7) are available on the DB15 connector.

Many software applications will need to initialize the flexible I/O to a known pin configuration. That requires calls to the low-level functions ConfigIO and ConfigTimerClock. Following are the values to set the pin configuration to the factory default state:

When using the high-level LabJackUD driver, this could be done with the following requests:


ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 0, 0);
ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0);
ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ, 0);
ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 0, 0);
ePut (lngHandle, LJ_ioPUT_COUNTER_ENABLE, 0, 0, 0);
ePut (lngHandle, LJ_ioPUT_COUNTER_ENABLE, 1, 0, 0);
ePut (lngHandle, LJ_ioPUT_DAC_ENABLE, 1, 0, 0);  //Ignored on hardware rev 1.30+.
ePut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_PORT, 0, 0, 16);

… or with a single request to the following IOType created exactly for this purpose:


ePut (lngHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0);
tags:

Comments

#1

The first shortend names (DAC, AIN, FIO, EIO) are understandeble without explanation. But what means CIO? Which functionallity has such a port?

#2

The origin of the names is FIO=Flexible, EIO=Expansion, CIO=Control, and MIO=Multiplexing, but those names don't always have true meaning.

This section is discussing flexible I/O.  That is, I/O that can be digital or analog, which is FIO and EIO.  CIO are digital only, and as digital I/O are identical to EIO.  See Section 2.8 (which is discussing all digital I/O not just flexible I/O) and Section 2.11.

#3

Can the LJ contro panel be used to configure the channels to analog or digital.  am using DAQ FACTORY and it says

Request made on pin not properly configured for analog/digital

Do I use the overhead procedure, or is there another way to configure it?

Thanks........

#4

In LJControlPanel you can use the "Config Defaults" option (not the test panel) to set the power-up defaults.

Another option is to use configuration script like you see in Section 4.3.2.

However, in current versions of DAQFactory if you define analog or digital channels in the Channels table, DF will control the configuration automatically and thus should override anything else.  If that does not seem to be working, perhaps send a simple example CTL to support@labjack.com that shows the problem.

#5

what is the bit rate of the digital output signals???

#6

Besides serial I/O, the digital outputs on the U3 are updated in command/response mode, so see Section 3.1 of the U3 User's Guide.  You can update all digital outputs in as little as 600 us.

One trick for faster outputs is that you can put multiple updates in a single low-level packet, and thus can do multiple updates within a single 600 us command.  The PUT_WAIT iotype is often used to add a little delay between the updates.

For serial I/O, it takes the same Section 3.1 time to send the command and receive the response, and within the command the max bit rate is about 100 kHz for SPI and I2C, and some MHz for Asynchronous.

#7

If the Flexible I/O ports are 5.0 V tolerant, is it possible to set a flexible I/O port to 5.0 V for bit high, or can it only be 3.3 V?

#8

No.  When set to output-high the digital line is connected to the microcontroller power rail which is 3.3 volts.  The fact that the line is 5-volt tolerant means you can connect 5 volts to a digital input without problems (see the actual limits in the specifications in Appendix A).

In some cases you can use a pull-up resistor to VS (5 volts), and then set the digital line to input to get your 5 volt signal, but it depends on how much current your load is going to draw and what the required logic thresholds are.  Say for example you add a 10k resistor 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 you set EIO0 to input you have 100k to 3.3 volts in parallel with a 10k to 5 volts, and thus the line will sit at about 4.85 volts.  When you set the line to output-low, you have the internal 180 ohms in series with the 10k, so should pull the line 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.  I suggest the CD74ACT541E from TI (buy from Digikey).  You just need a few wires to bring VS, GND, and the signal from the LabJack to the chip. This chip lets you 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 DACs on the U3 can be set to 5 volts, so that gets you 2 output lines with such capability.

#9

Also note that most 5 volt logic will recognize 3.3 volts as a high. 
It is very common for digital logic to define low as less than ~1 volt
and high as greater than ~2 volts.

An exception is logic that
defines a guaranteed high as 0.7*Vs.  If Vs is 5 volts, that means 3.5
volts could be required to guarantee a high reading.

 

#10

Also, if the reason you want 5 volts is to drive a load like a
solid-state relay or an LED, see the following which discuss sinking
configurations:  Section 2.8.1.4 and LED App Note.