« Close

Datasheets and User Guides

App Notes

Software & Driver

 

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:

Table 2.5-1. Analog Input Pin Locations

AIN0 FIO0   AIN8 EIO0
AIN1 FIO1   AIN9 EIO1
AIN2 FIO2   AIN10 EIO2
AIN3 FIO3   AIN11 EIO3
AIN4 FIO4   AIN12 EIO4
AIN5 FIO5   AIN13 EIO5
AIN6 FIO6   AIN14 EIO6
AIN7 FIO7   AIN15 EIO7

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:

Table 2.5-2. ConfigIO Factory Default Values

Byte #      
6 WriteMask 15 Write all parameters
8 TimerCounterConfig 0 No Timers/Counters. Offset = 4
9 DAC1 Enable 0 DAC1 Disabled. (Ignored on HW 1.3)
10 FIOAnalog 0 FIO all digital.
11 EIOAnalog 0 EIO all digital.

Table 2.5-3. ConfigTimerClock Factory Default Values

Byte #      
8 TimerClockConfig 130 Set clock to 48MHz.
9 TimerClockDivisor 0 Divisor = 0.

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);

13 comments

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?

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.

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.

 

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.

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

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.

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........

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 [email protected] that shows the problem.

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

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.

Hello,

I'm using Labjack U3-HV for some time now, but never tried to use the DB15 connection. I probably didn't understand well how to configure it and would appreciate some help.

I'm trying to use the VS pin as a voltage source (5V) to an accelerometer, GND to ground and EIO0-EIO2 as analog inputs (for the X, Y and Z of the accelerometer).

How can I configure EIO0-EIO2 as analog inputs? I should be able to read them the same way I've been reading AIN0. Is that correct?

I'm using Ubuntu 12.04 with LJFuse.

 

Best wishes,

Flavio

 

I'm using a U3-HV with FlowStone and trying to change the EIO pins on the DB15 to analog input/output.

I believe I send the command through the I/O port on the U3 element that they have using the ePut command listed above. But I have not gotten the pins the alter. 

any tips?

The FIO/EIO on the U3 can be digital input (default), digital output, or low-voltage analog input.  Some can also do timer, counter, and serial communication.  They cannot be analog output.

An FIO/EIO can be configured as analog using the iotypes shown in Section 4.3.2, or automatically with a call to eAIN.  Not sure if FlowStone supports either of these methods.  If not, you can use "config defaults" in LJControlPanel to configure the desired lines as analog.