2.5 - Flexible I/O (FIO/EIO) [U3 Datasheet]
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);
Programming Guidance
See our Configuration, Digital I/O, and Timers & Counters pseudocode pages for programming guidance.