---
language: "en"
---
# Support and Documentation

Getting Started with a New Device? We recommend seeing our device [Quickstart Tutorials](https://support.labjack.com/docs/quickstart-tutorials.md).

## Support Subsections

* [Device Support Home](https://support.labjack.com/docs/device-support-home.md)
* [Datasheets](https://support.labjack.com/docs/datasheets.md)
* [App Notes](https://support.labjack.com/docs/app-notes.md)
* [Example Code/Wrappers](https://support.labjack.com/docs/example-code-wrappers.md)
* [Quickstart Tutorials](https://support.labjack.com/docs/quickstart-tutorials.md)
* [Software \& Driver](https://support.labjack.com/docs/software-driver.md)
* [Firmware](https://support.labjack.com/docs/firmware.md)
* [Compliance](https://support.labjack.com/docs/compliance.md)

## **Free Technical Support**

Every LabJack includes lifetime technical support. We are committed to providing quality, responsive support for all our products.

We believe written communication (live chat, [email](https://labjack.com/pages/contact)) is the best way to provide the best support. We can take a moment to research/test as needed, we can provide links to the extensive documentation on our site, we get a record of everything that was discussed, and we can easily loop in multiple people as needed.

*** ** * ** ***

## **Live Chat**

Hop on a live chat with the engineers who design and develop our products here in Colorado, USA.

We provide real-time chat Monday through Friday from 9-11 am and 1-4 pm, Denver time. Look for the chat bar at the bottom-right of every page.

![272bcf18-a4a4-b79a-1ab5-7a8e4fc6a429screenshot_2023_03_29_144756.png](https://support.labjack.com/__attachments/a_bbb28ed5a26557c2ef9b25b6ba138658126ea7b1eaa4bfe33416e09f16668414/272bcf18-a4a4-b79a-1ab5-7a8e4fc6a429screenshot_2023_03_29_144756.png?cb=0fc18145378fc5739a7e5bbf1fa9a2a2)  

## **Email**

If a LabJack support engineer is not available for live chat, you can send us an email at [support@labjack.com](mailto:support@labjack.com).

Although we prioritize live chat, we almost always respond to emails within 1 business day. If you have been waiting more than 24 hours don't hesitate to contact us via another method.

*** ** * ** ***

## [**Contact Us**](https://labjack.com/pages/contact)

The [contact us](https://labjack.com/pages/contact) page describes all of the methods you can use to reach us.  

## **LabJack Search Bar**

LabJack has detailed datasheets, app-notes and support materials. Use the search bar for faster navigation to find exactly what you are looking for.

![search.png](https://support.labjack.com/__attachments/a_11067467b35523f31b0271f99f15d70d6d6ee48cd0be5fd112434d778ca58031/search.png?cb=57243a3709ac85b3946d2a2bac63e83e)

*** ** * ** ***

## FASQ

See our [frequently asked support questions (FASQ)](https://support.labjack.com/docs/frequently-asked-support-questions-fasq.md) for solutions to common support problems.

---
language: "en"
---
# 1.0 Device Overview \[T-Series Datasheet\]

This document contains device-specific information for the following devices:

* T4

* T4-OEM

* T7

* T7-Pro

* T7-OEM

* T7-Pro-OEM

* T8

This family introduces a new line of high-quality analog and Ethernet data acquisition hardware combined with the main traditional advantage of all LabJack data acquisition hardware---namely, high performance and rich feature set at a competitive price point. These features make the T-series a logical choice for many high-performance applications where Ethernet, WiFi, and cost are primary considerations.

## Core Features

### All T-Series Devices

* On-board [Lua scripting](https://support.labjack.com/docs/25-0-lua-scripting-t-series-datasheet.md) for custom, headless operation

T4  
**High Voltage Analog Inputs**

* 4 dedicated high voltage analog inputs (±10V, 12-bit resolution)

* Configurable resolution settings

**Flexible I/O**

* 8 configurable low voltage analog inputs (0-2.5V, 12-bit resolution) that can function as digital I/O lines

**Digital I/O**

* 8 dedicated digital I/O lines (EIO4-EIO7 and CIO0-CIO3)

**Analog Outputs**

* 2 Analog Outputs (10-bit, 0-5 volts)

* Additional analog outputs are possible via the LJTick-DAC

T7  
**Analog I/O**

* 14 Analog Inputs (16-18+ Bits Depending on Speed), expand to 84 with [MUX80](https://labjack.com/catalog/mux80)

* Single-Ended Inputs (14) or Differential Inputs (7)

* Instrumentation Amplifier Inputs

* Software Programmable Gains of x1, x10, x100, and x1000

* Analog Input Ranges of ±10, ±1, ±0.1, and ±0.01 Volts

* 2 Analog Outputs (12-Bit, \~0-5 Volts)

**Digital I/O**

* 23 Digital I/O

* Supports up to 10 counters

* Supports SPI, I2C, 1-Wire and Asynchronous Serial Protocols (Master Only)

* Supports Software or Hardware Timed Acquisition

* Maximum Input Stream Rate of 100 kHz (Depending on Resolution)

* Capable of Command/Response Times Less Than 1 millisecond

**Digital I/O Extended Features**

* Simple PWM Output (1-32 bit)

* PWM Output w/ phase control

* Pulse Output w/ phase control

* Positive edge capture

* Negative edge capture

* PWM measure

* Edge capture \& compare

* High speed counter

* Software counter

* Software counter w/ debounce

* Quadrature Input

* Easy Frequency Input

**Analog Input Extended Features**

* User Defined Slope \& Offset

* Thermocouple type E, J, K, R, T, and C calculations

* RTDs

* Thermistors

**Other highlights**

* Built-In CJC Temperature Sensor

* Watchdog system

* Field Upgradable Firmware

* Programmable Startup Defaults

* [LJTick](https://labjack.com/catalog/accessories) Compatible

**Fixed Current Outputs**

* 200 µA

* 10 µA

T8  
**Analog I/O**

* 8 Analog Inputs (21 bits at 100 Hz)

* Simultaneous Sampling

* Isolated - Each input in fully isolated

* Instrumentation Amplifier Inputs

* Software Programmable Gains of 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512

* 11 Analog Input Ranges from ±11 Volts, to ±0.019 Volts

* 2 Analog Outputs (16-Bit, 0-10 Volts, up to 20 mA)

**Digital I/O**

* 20 Digital I/O

* Configurable pull-ups and pull-downs

* Supports up to 7 hardware, or 16 software counters

* Supports SPI, I2C, 1-Wire and Asynchronous Serial Protocols (Master Only)

* Supports Software or Hardware Timed Acquisition

* Maximum Input Stream Rate of 50 kHz (Depending on Resolution)

* Capable of Command/Response Times Less Than 150 microsecond

**Digital I/O Extended Features**

* Simple PWM Output (1-32 bit)

* PWM Output w/ phase control

* Pulse Output w/ phase control

* Positive edge capture

* Negative edge capture

* PWM measure

* Edge capture \& compare

* High speed counter

* Software counter

* Software counter w/ debounce

* Quadrature Input

* Easy Frequency Input

* 100 MHz Clock Source

**Analog Input Extended Features**

* User Defined Slope \& Offset

* Thermocouple type E, J, K, R, T, and C calculations

* RTDs

* Thermistors

**Other Highlights**

* Built-In CJC Temperature Sensors

* Watchdog system

* Field Upgradable Firmware

* Programmable Startup Defaults

* [LJTick](https://labjack.com/catalog/accessories) Compatible

* [Power over Ethernet (PoE)](https://support.labjack.com/docs/9-1-poe-t-series-datasheet.md)

**Fixed Reference Output**

* 3.3 V

## Device Variants

T-Series devices are built in several configurations:

* **Standard**-- The standard device configuration. Comes in a red case with screw terminals and DB connectors installed.

* **OEM**-- The device PCB without USB, screw-terminals, or the DB connectors installed. Intended for customers that integrate LabJack devices into their own products.

* **Pro**(not available for all devices) -- The Pro option adds hardware upgrades such as higher resolution (ADC) and WiFi. This option can be stacked with any of the Standard or OEM configurations.

For more information about the OEM variants, see [Section 22: OEM Versions](https://support.labjack.com/docs/22-0-oem-versions-t-series-datasheet.md)

## Family Variants

### All T-series Devices

All T-Series devices use [Modbus TCP](https://labjack.com/support/software/api/modbus/protocol-details) and are compatible with the [LJM Library](https://support.labjack.com/docs/ljm-library-overview.md). Programs designed for one T-Series device will often work on other T-Series devices with minimal changes.

### T4 vs T7

T4 characteristics that differ from the T7:

* 12-bit effective resolution on HV and LV lines.

* AIN (0-3) are high voltage (±10V).

* Flexible I/O lines: The T4 I/O lines FIO (4-7) and EIO (0-3) are software-configurable to be either low voltage analog inputs (0-2.5V) or digital I/O lines (3.3V logic level).

### T7 vs T7-Pro

The T7-Pro has all features of the normal T7, with the following added:

* Wireless Ethernet 802.11b/g.

* 24-bit low-speed sigma-delta ADC.

* Battery-backed real time clock for stand-alone data logging.

* Factory installed microSD card for stand-alone data logging.

Also see the block diagram in the [hardware overview section](https://support.labjack.com/docs/4-0-hardware-overview-t-series-datasheet.md).

### T7-OEM and T7-Pro-OEM

There are also OEM versions of the T7 and T7-Pro. The OEM versions are the same in terms of features, but the enclosure and most connectors are not installed on the OEM versions, allowing customization as needed. See [22.0 OEM Versions](https://support.labjack.com/docs/22-0-oem-versions-t-series-datasheet.md) for details.

### T8

The T8 builds upon the success of the T4 and T7 devices and adds unique features previously unavailable to LabJack customers.

* 8 Isolated Analog Inputs (1000 Vrms channel to channel and channel to ground isolation

* Simultaneous sampling for added timing precision

* 24-bit ΣΔ ADC (up to 40k samples/s/ch) previous LabJack devices with high resolution converters were low speed sampling

* 10+ different Voltage Ranges:±11V, ±9.6V, ±4.8V, ±2.4V,±1.2V, ±0.6V, ±0.3V, ±0.15V,±0.75V, ±0.36V, and ±0.18V

---
language: "en"
---
# 1.1 - Control Panel Application (LJControlPanel) \[U3 Datasheet\]

The application LJControlPanel is included with the [Windows installation package](https://support.labjack.com/docs/ud-software-installer-downloads-u3-u6-ue9.md).

The LabJack Control Panel application (LJCP) handles configuration and testing of the UD series hardware (U3, U6 and UE9). Click on the "Find Devices" button to search for connected devices.  
![u3ds-ljcp233-70pct.jpg](https://support.labjack.com/__attachments/a_faaa0f56f29ceef3ea9c742f0526a85ea9a78d9a9e3bfbfc12cd3b0788be94e9/u3ds-ljcp233-70pct.jpg?cb=17967162843d2afce26e401839510a2a)

Figure 1-1 shows the results from a typical search. The application found two devices. The USB connection for a U3 has been selected in Figure 1-1, bringing up the configuration window on the right side.

* Refresh: Reload the window using values read from the device.

* Write Values: Write the Local ID from the window to the device.

* Config Defaults: Opens the window shown in Figure 1-2.

* Reset: Click to reset the selected device.

* Test: Opens the window shown in Figure 1-3. Starts with Factory Default settings.

## Config Defaults

This option provides control over the condition of the device at power-up or reset. Figure 1-2 shows a U3-HV with the factory default power-up configuration, which means AIN0-AIN3 set to analog input, FIO4 to CIO3 set to digital input, analog outputs set to minimum voltage (near 0), and timers/counters/watchdog disabled.  
![u3ds-ljcp233-defaults-70pct.png](https://support.labjack.com/__attachments/a_2cff4dc3c66b5f1255d4bf7869f56dcf4f635874d33e92d1e778dc7eca4f4865/u3ds-ljcp233-defaults-70pct.png?cb=ae8d98d47a1df318d10c60b3a9eea049)

* Write Factory Values: Clicking this will set everything back to the factory defaults and write those factory defaults to nonvolatile memory.

* Write Values: Change any desired settings, and then click this to write the new settings to nonvolatile memory.

## Test Panel

Figure 1-3 shows the test window for a U3 device. This window continuously (once per second) writes to and reads from the selected LabJack.  
![u3ds-ljcp233-test-70pct.jpg](https://support.labjack.com/__attachments/a_380d717107701887d53e261dcca8d404d6bcacbc74b1f96e271913a3f33e75f9/u3ds-ljcp233-test-70pct.jpg?cb=ce089e8002288f2d42ef0fd9bd160a4a)

Any configuration done on this screen is not written to nonvolatile memory. These settings just affect the current condition of the device, not the reset/power-up condition.

When the test panel first loads it sets everything to factory default, so previous settings (or reset/power-up settings) will not be shown.

## LJCP Settings

Selecting Options=\>Settings from the main LJControlPanel menu brings up the window shown in Figure 1-4. This window allows some features to of the LJControlPanel application to be customized.  
![ljcp233-settings-80pct.png](https://support.labjack.com/__attachments/a_9e02f5af964178f720e5b9f86ecd70d0ff43d53c1d82fad52f3a27a13f99d26b/ljcp233-settings-80pct.png?cb=c7972129bc0f5bb9f2fee6acae8ec3a9)

Search for USB devices: If selected, LJControlPanel will include USB when searching for devices.

---
language: "en"
---
# 1.1 - Control Panel Application (LJControlPanel) \[U6 Datasheet\]

The LabJack Control Panel application (LJCP) handles configuration and testing of the U6. Click on the "Find Devices" button to search for connected devices.  
[![11-ljcp.png](https://support.labjack.com/__attachments/a_03ee7f044b882a710319bdedcee39613b73020079f4eb07d6485fca15ff64a78/11-ljcp.png?cb=31346a7588ec0248ea087813e0a5181c) **Figure 1.1-1.** LJControlPanel Device Window](/__attachments/a_03ee7f044b882a710319bdedcee39613b73020079f4eb07d6485fca15ff64a78/11-ljcp.png.md?cb=31346a7588ec0248ea087813e0a5181c)

Figure 1.1-1 shows the results from a typical search. The application found a U6 connected by USB. The USB connection has been selected in Figure 1-1, bringing up the main device window on the right side.

* Refresh: Reload the window using values read from the device.

* Write Values: Write the Local ID from the window to the device.

* Config. IO Defaults: Opens the window shown in Figure 1-2.

* Reset: Click to reset the selected device.

* Test: Opens the window shown in Figure 1-3. Starts with Factory Default settings.

[![11-ljcp-cdw.png](https://support.labjack.com/__attachments/a_d12d8833becdfc0e12d60c1b7a29808eadf6473f45ba565f621156a3903e82c9/11-ljcp-cdw.png?cb=b2afc2eb825cc06fb42eaed28804f829) **Figure 1.1-2.** LJControlPanel U6 Configure Defaults Window](/__attachments/a_d12d8833becdfc0e12d60c1b7a29808eadf6473f45ba565f621156a3903e82c9/11-ljcp-cdw.png.md?cb=b2afc2eb825cc06fb42eaed28804f829)

Figure 1.1-2 shows the configuration window for U6 defaults. These are the values that will be loaded by the U6 at power-up or reset. The factory defaults are shown above.

Figure 1.1-3 shows the U6 test window. This window continuously (once per second) writes to and reads from the selected LabJack.  
[![11-ljcp-tp.jpg](https://support.labjack.com/__attachments/a_bb0ebc33cd223749807b7b5d1af27a36a07cf177a4bdddb3070e6ab7ce08f7dd/11-ljcp-tp.jpg?cb=49b4265392b603563e1b525c6d1b718d) **Figure 1.1-3.** LJControlPanel U6 Test Window](/__attachments/a_68b6413021523baccaa1d5f2aac55a664abc6979b3ce4f5d479e6e458c7a1969/11-ljcp-tp.png.md?cb=27c60e6dc317d74eff65e4e069d4d4fc)

Selecting Options=\>Settings from the main LJControlPanel menu brings up the window shown in Figure 1.1-4. This window allows some features to of the LJControlPanel application to be customized.

[![11-ljcp-settings.png](https://support.labjack.com/__attachments/a_f0772b4b7e1c399c58599a54141a61e06dfbaffaa36c3a69ab55acad9e3d083b/11-ljcp-settings.png?cb=3a6a204bb107de85bd43ee95075f58ea) **Figure 1.1-4.** LJControlPanel Settings Window](/__attachments/a_f0772b4b7e1c399c58599a54141a61e06dfbaffaa36c3a69ab55acad9e3d083b/11-ljcp-settings.png.md?cb=3a6a204bb107de85bd43ee95075f58ea)

* Search for USB devices: If selected, LJControlPanel will include USB when searching for devices.

* Search for Ethernet devices using UDP broadcast packet: Does not apply to the U6.

* Search for Ethernet devices using specified IP addresses: Does not apply to the U6.

---
language: "en"
---
# 1.1 - Control Panel Application (LJControlPanel) \[UE9 Datasheet\]

The LabJack Control Panel application (LJCP.exe) handles configuration and testing of the UE9. Click on the "Find LabJacks" button to search for connected devices.

[![ue9ug-11-ljcp.png](https://support.labjack.com/__attachments/a_d3fc8ec475d0d163945af2835b7b5b6fd3706e8fac23462921461a98a11258ba/ue9ug-11-ljcp.png?cb=afadc47abfc553cd41b907815847c5ba)](/__attachments/a_d3fc8ec475d0d163945af2835b7b5b6fd3706e8fac23462921461a98a11258ba/ue9ug-11-ljcp.png.md?cb=afadc47abfc553cd41b907815847c5ba)

Figure 1.1-1 shows the results from a typical search. The application found one UE9 connected by USB and Ethernet. It also found a second UE9 that is accessible only by Ethernet. The USB connection has been selected in Figure 1.1-1, bringing up the configuration window on the right side.

* Refresh: Reload the window using values read from the device.

* Write to Device: Write the values from the window to the device. Depending on the values that have been changed, the application might prompt for a device reset.

* Reset: Click to reset the selected device.

* Test: Opens the window shown in Figure 1.1-2. This window continuously writes to and reads from the selected LabJack. Starts with Factory Default settings.

[![ue9ug-11-ljcp2.png](https://support.labjack.com/__attachments/a_e2130add3102436f4fb0cb56d975720153fefbb507ae862d3bf653c58ae8fea5/ue9ug-11-ljcp2.png?cb=e0ea95fe1ed08c95134f44267c6d229d)](/__attachments/a_e2130add3102436f4fb0cb56d975720153fefbb507ae862d3bf653c58ae8fea5/ue9ug-11-ljcp2.png.md?cb=e0ea95fe1ed08c95134f44267c6d229d)

Selecting Options=\>Settings from the main LJControlPanel menu brings up the window shown in Figure 1.1-3. This window allows some features to of the LJControlPanel application to be customized.

[![ue9ug-11-ljcp3.png](https://support.labjack.com/__attachments/a_b01cdc3b74f757e2b8cf6fe221035d00263cae9ef989eb969d74e3bb3369adca/ue9ug-11-ljcp3.png?cb=9359bf92460572c4fac56b6e5ea81ff5)](/__attachments/a_b01cdc3b74f757e2b8cf6fe221035d00263cae9ef989eb969d74e3bb3369adca/ue9ug-11-ljcp3.png.md?cb=9359bf92460572c4fac56b6e5ea81ff5)

* Search for USB devices: If selected, LJControlPanel will include USB when searching for devices.

* Search for Ethernet devices using UDP broadcast packet: Normally, Ethernet connected devices are found using a broadcast of the [DiscoveryUDP](https://support.labjack.com/docs/discoveryudp-ue9-only.md). On some networks, however, it might not be desirable to broadcast these UDP packets. There are also situations where a network might have proper TCP communication between the PC and LabJack, but the broadcast UDP packet does not work.

* Search for Ethernet devices using specified IP addresses. When this option is selected, LJControlPanel will specifically search over TCP using each address in the list. On some networks this might be preferred over the UDP broadcast search.

---
language: "en"
---
# 1.1 - Hardware Installation \[U12 Datasheet\]

With the PC on and using the included cable, connect the LabJack U12 to the USB port on the PC or USB hub. The USB cable provides power and communication for the LabJack U12. The status LED should immediately blink 4 times (at about 4 Hz), and then stay off while the LabJack enumerates.

Enumeration is the process where the PC's operating system gathers information from a USB device that describes it and it's capabilities. The low-level drivers for the LabJack U12 come with Windows and enumeration will proceed automatically. The first time a device is enumerated on a particular PC, it can take a minute or two, and Windows might prompt you about installing drivers. Accept all the defaults at the Windows prompts, and reboot the PC if asked to do so. The Windows Installation CD might also be needed at this point. Make sure a CD with the correct version of Windows is provided. Enumeration occurs whenever the USB cable is connected, and only takes a few seconds after the first time.

When enumeration is complete, the LED will blink twice and remain on. This means Windows has enumerated the LabJack properly.

The U12 enumerates as an HID (Human Interface Device). Following are screenshots from Windows Device Manager with no U12 connected and with 1 U12 connected.  
![wdmu12notenumerated.png](https://support.labjack.com/__attachments/a_7d8f32249d86ba44f95f12d2a53608b59fdafadac603aba55304020bd018d4e4/wdmu12notenumerated.png?cb=95996b59179d980313872da18734967c)  
![wdmu12enumerated.png](https://support.labjack.com/__attachments/a_cef929c63bbeccef3e660447fc6c64dd9eb77dc5be7f3276dc1a36e22a0e9236/wdmu12enumerated.png?cb=25411488bd50edb137d73aae57af74ab)

The exact entries can vary with different versions of Windows, but in the above Windows 10 screenshot connecting 1 U12 gives us 2 entries under Human Interface Devices: "HID-compliant device" and "USB Input Device". Right-click on either of these, choose Properties, go to the Details tab, set Property = Hardware Ids, and you will see the LabJack USB vendor ID of 0x0CD5.

If the U12 fails to enumerate:

* Make sure you are running Windows OS version 4.10.2222 or higher.

* Try connecting the U12 to another PC.

* Try connecting a different USB device to the PC.

* See [Appendix C - U12 Hardware Troubleshooting](https://support.labjack.com/docs/appendix-c-u12-hardware-troubleshooting-u12-datash.md).

* See the [USB Communication Failure](https://support.labjack.com/docs/usb-communication-failure-app-note.md) application note.

---
language: "en"
---
# 1.2 - Self-Upgrade Application (LJSelfUpgrade) \[U3 Datasheet\]

The processor in the U3 has field upgradeable flash memory. The self-upgrade application shown in Figure 1-5 programs the latest firmware onto the processor.

USB is the only interface on the U3, and first found is the only option for self-upgrading the U3, so no changes are needed in the "Connect by" box. There must only be one U3 connected to the PC when running LJSelfUpgrade.

Click on "Get Version Numbers" to find out the current firmware versions on the device. Then use the provided [Firmware Upgrade File](https://support.labjack.com/docs/u3-firmware-overview.md) internet link to go to labjack.com, go to the U3 Firmware subsection, and check for more recent firmware. Download firmware files to the any location on your computer.

Click the Browse button and select the firmware file to program. Click the Program button to begin the self-upgrade process.  
![0b7bef06-e87e-e51f-a24e-5a9536356c9blj_self_upgrade_131_u3_example.png](https://support.labjack.com/__attachments/a_45e4b7c763dc29708639582077f759882482a9d8546fb7972eb11ab6510ca303/0b7bef06-e87e-e51f-a24e-5a9536356c9blj_self_upgrade_131_u3_example.png?cb=57dcaeadbf50ddb1f68912b765ef0c32)

## SPC Troubleshooting

If problems are encountered during programming, try the following:

1. Unplug the U3, wait 5 seconds then reconnect the U3. Click OK then press program again.

2. If step 1 does not fix the problem, unplug the U3 and watch the LED while plugging the U3 back in. Follow the following steps based on the LED's activity:

3. **If the LED is blinking continuously (flash mode)**, connect a jumper between FIO4 and SPC (FIO0 to SCL on U3 1.20/1.21), then unplug the U3, wait 5 seconds and plug the U3 back in. Try programming again (disconnect the jumper before programming).

4. **If the LED blinks several times and stays on**, connect a jumper between FIO5 and SPC (FIO1 to SCL on U3 1.20/1.21), then unplug the U3, wait 5 seconds and plug the U3 back in. Try programming again (disconnect the jumper before programming).

5. **If the LED blinks several times and stays off**, the U3 is not enumerating. Please restart your computer and try to program again.

6. **If there is no LED activity**, connect a jumper between FIO5 and SPC (FIO1 to SCL on U3 1.20/1.21), then unplug the U3, wait 5 seconds and plug the U3 back in. If the LED is blinking continuously click OK and program again (after removing the jumper). If the LED does not blink connect a jumper between FIO4 and SPC (FIO0 to SCL on U3 1.20/1.21), then unplug the U3, wait 5 seconds and plug the U3 back in.

7. **If the LED does a repeating pattern of 3 blinks then pause**, the U3 has detected internal memory corruption and you will have to contact LabJack Support.

8. If there is no activity from the U3's LED after following the above steps, please contact support.

---
language: "en"
---
# 1.2 - Self-Upgrade Application (LJSelfUpgrade) \[U6 Datasheet\]

The processor in the U6 has field upgradeable flash memory. The self-upgrade application shown in Figure 1-5 programs the latest firmware onto the processor.

USB is the only interface on the U6, and first found is the only option for self-upgrading the U6, so no changes are needed in the "Connect by" box. There must only be one U6 connected to the PC when running LJSelfUpgrade.

Click on "Get Version Numbers" to find out the current firmware versions on the device. Then use the provided [Firmware Upgrade File](https://support.labjack.com/docs/u6-firmware-overview.md) internet link to go to labjack.com, go to the U6 Firmware subsection, and check for more recent firmware. Download firmware files to the any location on your computer.

Click the Browse button and select the firmware file to program. Click the Program button to begin the self-upgrade process.  
![046a6152-c108-44da-00fd-0207929612ablabjack_u6_lj_self_upgrade_131.png](https://support.labjack.com/__attachments/a_57c1c5e0b20aa5a510a624d3bfc3806e8ada59f2215e633869a5c2993e1b987a/046a6152-c108-44da-00fd-0207929612ablabjack_u6_lj_self_upgrade_131.png?cb=65fa9557ff563e93f87217432da55bf6)

## SPC Troubleshooting

If problems are encountered during programming, try the following:

1. Unplug the U6, wait 5 seconds then reconnect the U6. Click OK then press program again.

2. If step 1 does not fix the problem, unplug the U6 and watch the LED while plugging the U6 back in. Follow the following steps based on the LED's activity:

3. **If the LED is blinking continuously**, connect a jumper between FIO0 and SPC, then unplug the U6, wait 5 seconds and plug the U6 back in. Try programming again (disconnect the jumper before programming).

4. **If the LED blinks several times and stays on**, connect a jumper between FIO1 and SPC, then unplug the U6, wait 5 seconds and plug the U6 back in. The LED should blink continuously indicating flash mode. Try programming again while the device is in flash mode (disconnect the jumper before programming).

5. **If the LED blinks several times and stays off**, the U6 is not enumerating. Please restart your computer and try to program again.

6. **If there is no LED activity**, connect a jumper between FIO1 and SPC, then unplug the U6, wait 5 seconds and plug the U6 back in. If the LED is blinking continuously click OK and program again (after removing the jumper). If the LED does not blink connect a jumper between FIO0 and SPC, then unplug the U6, wait 5 seconds and plug the U6 back in.

7. If there is no activity from the U6's LED after following the above steps, please contact support.

---
language: "en"
---
# 1.2 - Self-Upgrade Application (LJSelfUpgrade) \[UE9 Datasheet\]

Both processors in the UE9 have field upgradeable flash memory. The self-upgrade application shown in Figure 1.2-1 programs the latest firmware onto either processor.

First, put valid values in the "Connect by" box. If USB, select first found or specify a local ID. If Ethernet, specify the IP Address. These values will be used for programming and everything else.

Click on "Get Version Numbers" to find out the current firmware versions on the device. Then use the provided [Firmware Upgrade File](https://support.labjack.com/docs/firmware.md) internet link to go to labjack.com, go to the UE9 Firmware subsection, and check for more recent firmware. Download firmware files to the any location on your computer.

Click the Browse button and select the firmware file to program. Based on the file name, the application will determine whether the Comm or Control processor is to be programmed.

Click the Program button to begin the self-upgrade process.  
![ue9ds-ljsu131-s.png](https://support.labjack.com/__attachments/a_f25ed37eadee748aaf5324357b18078bdf4fb335b4ae28190cea3ad37a51d9f5/ue9ds-ljsu131-s.png?cb=5283a59b062a1c12fb20c590cce555c7)

If problems are encountered during programming, try the following:

1. Unplug the UE9, wait 5 seconds then reconnect the UE9. Click OK then press program again.

2. If step 1 does not fix the problem, unplug the UE9 and watch the Control and Control LEDs while plugging the UE9 back in. Follow the following steps based on the Comm and Control LEDs' activity:

3. **If the Comm LED blinks several times and the Control LED is blinking rapidly (flash mode)**, connect a jumper between FIO0 and SCL, then unplug the UE9, wait 5 seconds and plug the UE9 back in. Try programming again (disconnect the jumper before programming).

4. **If the Comm LED blinks several times and the Control LED has no activity**, connect a jumper between FIO1 and SCL, then unplug the UE9, wait 5 seconds and plug the UE9 back in. Try programming again (disconnect the jumper before programming).

5. **If the Comm LED has no activity**, the UE9's Comm processor is not starting properly. Please restart your computer and try programming again.

6. If there is no activity from the UE9's LEDs after following the above steps, please contact support.

---
language: "en"
---
# 1.2 - Software Installation \[U12 Datasheet\]

Although the low-level USB drivers for the LabJack are included with Windows, high-level drivers are needed to send and receive data. Get started by going to labjack.com/support/u12.

When the LabJack installation is finished, it will start the National Instruments LabVIEW Run-Time Engine (LVRTE) setup. The LVRTE is required for the example applications such as LJtest. If prompted to reboot after this installation, go ahead and do so. Virus scanners can often interfere with the installation of the LVRTE. If you have trouble running the example applications, repeat the LabJack software installation to make sure the LVRTE is installed.

To test the installation, start LJtest by selecting

Start → Programs → LabJack U12 Legacy → Legacy U12 Samples → LJtest.

Make sure "Test Fixture Installed" and "Continuous" are not selected, and press the "Run" button. LJtest will step through 14 separate tests and all should pass. The I/O tests assume nothing is connected to the U12 (except USB), so they will likely fail if you have any connections.  
![ljtest-v114.jpg](https://support.labjack.com/__attachments/a_b9d15d8ef451e382ff613694e20b51ff736bbbdefc2127570122a65928ea699f/ljtest-v114.jpg?cb=07628d87cd754a94996ed168f9bcede6)

---
language: "en"
---
# 1.3 - LJLogUD and LJStreamUD \[U6 Datasheet\]

Two sample applications are available that can handle the basic data collection needs of many customers. LJLogUD uses command/response mode ([Section 3.1](https://support.labjack.com/docs/3-1-command-response-u6-datasheet.md)) while LJStreamUD uses stream mode ([Section 3.2](https://support.labjack.com/docs/3-2-stream-mode-u6-datasheet.md)). Go to the pages for each application for more information and to download:

[LJLogUD Page](https://support.labjack.com/docs/ljlogud-windows-only.md)

[LJStreamUD Page](https://support.labjack.com/docs/ljstreamud-windows-only.md)

---
language: "en"
---
# 1 - Installation \[U12 Datasheet\]

The LabJack U12 requires a PC running Windows 98SE/ME/2000/XP/Vista/7/8 or newer. To determine your operating system version, go to:

Start → Settings → Control Panel → System → General

and make sure the version number is 4.10.2222 or higher (Win98SE=4.10.2222, WinME=4.90.3000, Win2000=5.0.2195, WinXP=5.1.XXXX).

It does not matter if the hardware or software is installed first.

If you experience installation problems on Windows 98 Second Edition, before contacting us, please go [the Windows 98 Second Edition support page](https://support.labjack.com/docs/archived-barebones-versions.md).

## Subsections

* [1.1 - Hardware Installation \[U12 Datasheet\]](https://support.labjack.com/docs/1-1-hardware-installation-u12-datasheet.md)
* [1.2 - Software Installation \[U12 Datasheet\]](https://support.labjack.com/docs/1-2-software-installation-u12-datasheet.md)

---
language: "en"
---
# 1 - Installation \[U3 Datasheet\]

## Subsections

* [1.1 - Control Panel Application (LJControlPanel) \[U3 Datasheet\]](https://support.labjack.com/docs/1-1-control-panel-application-ljcontrolpanel-u3-da.md)
* [1.2 - Self-Upgrade Application (LJSelfUpgrade) \[U3 Datasheet\]](https://support.labjack.com/docs/1-2-self-upgrade-application-ljselfupgrade-u3-data.md)

## Windows

The UD driver requires a PC running Windows. For other operating systems, go to labjack.com for available support. Software will be installed to the LabJack directory which defaults to c:\\Program Files\\LabJack\\.

**Install the software first** : Go to our [UD Software Installer](https://support.labjack.com/docs/ud-software-installer-downloads-u3-u6-ue9.md) page.

**Connect the USB cable** : The USB cable provides data and power. After the UD software installation is complete, connect the hardware and Windows should prompt with "*Found New Hardware*" and shortly after the Found New Hardware Wizard will open. When the Wizard appears allow Windows to install automatically by accepting all defaults.

**Run LJControlPanel**: From the Windows Start Menu, go to the LabJack group and run LJControlPanel. Click the "Find Devices" button, and an entry should appear for the connected U3 showing the serial number. Click on the "USB -- 1" entry below the serial number to bring up the U3 configuration panel. Click on "Test" in the configuration panel to bring up the test panel where you can view and control the various I/O on the U3.

If LJControlPanel does not find the U3, check Windows Device Manager to see if the U3 installed correctly. One way to get to the Device Manager is:

Start =\> Control Panel =\> System =\> Hardware =\> Device Manager

The entry for the U3 should appear as in the following figure. If it has a yellow caution symbol or exclamation point symbol, right-click and select "Uninstall" or "Remove". Then disconnect and reconnect the U3 and repeat the Found New Hardware Wizard as described above.

Correctly Functioning U3 in Windows Device Manager

## Linux and Mac OS X

The Exodriver is the native USB driver for Linux and Mac OS X. With it you can use low-level functions to interact with your U3 over USB. The LJUD driver, LJControlPanel and LJSelfUpgrade applications are not available for Linux or Mac OS X.

Download the [Exodriver](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md). For Mac OS X you can use the Mac Installer for installation, otherwise use the source code and install script.

### Mac OS X Installer

Unzip the contents of Exodriver_NativeUSB_Setup.zip and run Exodriver_NativeUSB_Setup.pkg. Then follow the installer's instructions to install the driver.

### Source Code

### Mac OS X Requirements

• OS X 10.5 or newer• Xcode developer tools

### Linux Requirements

• Linux kernel 2.6.28 or newer.

• GNU C Compiler

• libusb-1.0 library and development files (header files)

### Installation

To install the driver from source code, first unzip the contents of the Exodriver source code. Then run the following commands in a terminal (replace \<Exodriver-Source-Directory\> with the directory you unzipped the Exodriver source code to):

#### - bash

`cd <Exodriver-Source-Directory> sudo ./install.sh`

Follow the install script's instructions to install the driver.

For more Exodriver installation information go to the [Exodriver](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md) page. The source code download's README, INSTALL.Linux and INSTALL.MacOSX also provides more information. If you run into problems, first take a look at the comments section of the Exodriver page as the issue may have been helped with previously.

After installation, to test your U3 connect it to your computer with a USB cable. The USB cable provides data and power. Build and run one of the examples from the source code download. Alternatively, install [LabJackPython](https://support.labjack.com/docs/labjackpython-for-ud-exodriver-u12-windows-mac-lin.md) and run one of its examples.

---
language: "en"
---
# 1 - Installation \[U6 Datasheet\]

## Subsections

* [1.1 - Control Panel Application (LJControlPanel) \[U6 Datasheet\]](https://support.labjack.com/docs/1-1-control-panel-application-ljcontrolpanel-u6-da.md)
* [1.2 - Self-Upgrade Application (LJSelfUpgrade) \[U6 Datasheet\]](https://support.labjack.com/docs/1-2-self-upgrade-application-ljselfupgrade-u6-data.md)
* [1.3 - LJLogUD and LJStreamUD \[U6 Datasheet\]](https://support.labjack.com/docs/1-3-ljlogud-and-ljstreamud-u6-datasheet.md)

## Windows

The UD driver requires a PC running Windows. For other operating systems, go to labjack.com for available support. Software will be installed to the LabJack directory which defaults to c:\\Program Files\\LabJack\\.

**Install the software first** : Go to our [UD Software Installer](https://support.labjack.com/docs/ud-software-installer-downloads-u3-u6-ue9.md) page.

**Connect the USB cable** : The USB cable provides data and power. After the UD software installation is complete, connect the hardware and Windows should prompt with "*Found New Hardware*" and shortly after the Found New Hardware Wizard will open. When the Wizard appears allow Windows to install automatically by accepting all defaults.

**Run LJControlPanel**: From the Windows Start Menu, go to the LabJack group and run LJControlPanel. Click the "Find Devices" button, and an entry should appear for the connected U6 showing the serial number. Click on the "USB -- 1" entry below the serial number to bring up the U6 configuration panel. Click on "Test" in the configuration panel to bring up the test panel where you can view and control the various I/O on the U6.

If LJControlPanel does not find the U6, check Windows Device Manager to see if the U6 installed correctly. One way to get to the Device Manager is:

Start =\> Control Panel =\> System =\> Hardware =\> Device Manager

The entry for the U6 should appear as in the following figure. If it has a yellow caution symbol or exclamation point symbol, right-click and select "Uninstall" or "Remove". Then disconnect and reconnect the U6 and repeat the Found New Hardware Wizard as described above.  
![1-devicemanager.png](https://support.labjack.com/__attachments/a_d016a8a69bea5c4d1a7a9b05d64e0d0a879e106077900a68d07e7366f46a188e/1-devicemanager.png?cb=da82d8e86045670b36beab329eae12e4)

## Linux and Mac OS X

The Exodriver is the native USB driver for Linux and Mac OS X. With it you can use low-level functions to interact with your U6 over USB. The LJUD driver, LJControlPanel and LJSelfUpgrade applications are not available for Linux or Mac OS X.

Download the [Exodriver](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md). For Mac OS X you can use the Mac Installer for installation, otherwise use the source code and install script.

### Mac OS X Installer

Unzip the contents of Exodriver_NativeUSB_Setup.zip and run Exodriver_NativeUSB_Setup.pkg. Then follow the installer's instructions to install the driver.

## Source Code

### Mac OS X Requirements

• OS X 10.5 or newer

• Xcode developer tools

### Linux Requirements

• Linux kernel 2.6.28 or newer.

• GNU C Compiler

• libusb-1.0 library and development files (header files)

## Installation

To install the driver from source code, first unzip the contents of the Exodriver source code. Then run the following commands in a terminal (replace \<Exodriver-Source-Directory\> with the directory you unzipped the Exodriver source code to):

### Install Exodriver - bash

`cd <Exodriver-Source-Directory> sudo ./install.sh`

Follow the install script's instructions to install the driver.

For more Exodriver installation information go to the Exodriver page at [labjack.com/support/linux-and-mac-os-x-drivers](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md). The source code download's README, INSTALL.Linux and INSTALL.MacOSX also provides more information. If you run into problems, first take a look at the comments section of the Exodriver page as the issue may have been helped with previously.

After installation, to test your U6 connect it to your computer with a USB cable. The USB cable provides data and power. Build and run one of the examples from the source code download. Alternatively, install LabJackPython (at [labjack.com/support/labjackpython](https://support.labjack.com/docs/labjackpython-for-ud-exodriver-u12-windows-mac-lin.md)) and run one of its examples.

---
language: "en"
---
# 1 - Installation \[UE9 Datasheet\]

The LJUD driver requires a PC running Windows. For other operating systems, go to labjack.com for available support. Software will be installed to the LabJack directory which defaults to c:\\Program Files\\LabJack\\.

**Install the software first** : Go to our [UD Software Installer](https://support.labjack.com/docs/ud-software-installer-downloads-u3-u6-ue9.md) page.

**Connect the USB cable** : (See [Section 2.2](https://support.labjack.com/docs/2-2-ethernet-ue9-datasheet.md) for Ethernet installation tips) The USB cable provides data and power. After the UD software installation is complete, connect the hardware and Windows should prompt with "Found New Hardware" and shortly after the Found New Hardware Wizard will open. When the Wizard appears allow Windows to install automatically by accepting all defaults.

**Run LJControlPanel**: From the Windows Start Menu, go to the LabJack group and run LJControlPanel. Click the "Find Devices" button, and an entry should appear for the connected UE9 showing the serial number. Click on the "USB -- 1" entry below the serial number to bring up the UE9 configuration panel. Click on "Test" in the configuration panel to bring up the test panel where you can view and control the various I/O on the UE9.

If LJControlPanel does not find the UE9, check Windows Device Manager to see if the UE9 installed correctly. One way to get to the Device Manager is:

Start =\> Control Panel =\> System =\> Hardware =\> Device Manager

The entry for the UE9 should appear as in Figure 1-1. If it has a yellow caution symbol or exclamation point symbol, right-click and select "Uninstall" or "Remove". Then disconnect and reconnect the UE9 and repeat the Found New Hardware Wizard as described above.  
![ue9ug-1-dm.png](https://support.labjack.com/__attachments/a_da853c4d510423028be9ddde1277417099a1f48b07dbce78008af7d7a9007a92/ue9ug-1-dm.png?cb=a52eb14a12dad9ecf02cbdd10c006822)

## Subsections

* [1.1 - Control Panel Application (LJControlPanel) \[UE9 Datasheet\]](https://support.labjack.com/docs/1-1-control-panel-application-ljcontrolpanel-ue9-d.md)
* [1.2 - Self-Upgrade Application (LJSelfUpgrade) \[UE9 Datasheet\]](https://support.labjack.com/docs/1-2-self-upgrade-application-ljselfupgrade-ue9-dat.md)

## Linux and Mac OS X

The Exodriver is the native USB driver for Linux and Mac OS X. With it you can use low-level functions to interact with your UE9 over USB. A TCP interface is not included in the Exodriver, but most programming languages have a TCP library to use. We demonstrate low-level function usage over TCP using C/C++ in the our [UE9 TCP examples](https://support.labjack.com/docs/ue9-c-native-tcp-example-ue9-datasheet.md). The LJUD driver, LJControlPanel and LJSelfUpgrade applications are not available for Linux or Mac OS X.

Download the [Exodriver](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md). For Mac OS X you can use the Mac Installer for installation, otherwise use the source code and install script.

### Mac OS X Installer

Unzip the contents of Exodriver_NativeUSB_Setup.zip and run Exodriver_NativeUSB_Setup.pkg. Then follow the installer's instructions to install the driver.

### Source Code

### Mac OS X Requirements

• OS X 10.5 or newer

• Xcode developer tools

### Linux Requirements

• Linux kernel 2.6.28 or newer.

• GNU C Compiler

• libusb-1.0 library and development files (header files)

### Installation

To install the driver from source code, first unzip the contents of the Exodriver source code. Then run the following commands in a terminal (replace \<Exodriver-Source-Directory\> with the directory you unzipped the Exodriver source code to):

`cd <Exodriver-Source-Directory> sudo ./install.sh`

Follow the install script's instructions to install the driver.

For more Exodriver installation information go to the [Exodriver](https://support.labjack.com/docs/exodriver-downloads-for-ud-series-linux-and-macos-.md) page. The source code download's README, INSTALL.Linux and INSTALL.MacOSX also provides more information. If you run into problems, first take a look at the comments section of the Exodriver page as the issue may have been helped with previously.

After installation, to test your UE9 connect it to your computer with a USB cable. The USB cable provides data and power. Build and run one of the examples from the source code download. Alternatively, install [LabJackPython](https://support.labjack.com/docs/labjackpython-for-ud-exodriver-u12-windows-mac-lin.md) and run one of its examples.

---
language: "en"
---
# 1 - Introduction (Applies to UD-Series)

## 1.1 - Welcome

With DAQFactory-Express you can take data and control outputs, log data to files easily read by other programs like Excel, create your own screens for displaying your data using any combination of 10 screen components including buttons, graphs, images and more.

For more advanced applications, consider one of the other versions of DAQFactory which, depending on the version, include 42 screen components, networking, PID, alarming, a 3800 image library, unlimited channels, unlimited pages, unlimited scripting and much more. All your DAQFactory-Express applications will work in the other versions of DAQFactory. Go to www.daqexpress.com for a table describing the different versions.

This document will start you on your way using your new device with DAQFactory-Express and will also work in all the other versions of DAQFactory. Feel free to use DAQFactory-Express to its full capabilities. If you need a more powerful version such as demonstrated by the trial version, please visit www.azeotech.com or your LabJack reseller to purchase a license.

For updates to DAQFactory Express, sample documents and other DAQFactory Express specific information, please visit www.daqexpress.com.

This document is not for the LabJack U12, which uses a different driver. Please see the DAQFactory help file for

information on using the U12 with DAQFactory.

## 1.2 - How to use this guide

This document explains how to do the most common things with DAQFactory and your LabJack device. Because it is likely that you will actually want to do the things described in the first eight chapters, we strongly recommend you actually go through the first eight chapters. After that, you will probably want to jump to the appropriate section in the later part of the manual that describes how to perform more specific tasks with your LabJack device.

Most of the sections include a sample document that you can load directly into DAQFactory. These applications are included in the LJGuideSamples directory of your DAQFactory installation. The exact file name is specified on each page.

## 1.3 - Acknowledgments

We would like to thank the following companies for their excellent components and tools which are in use by DAQFactory or were used to help create DAQFactory.

**Dundas Software:** For their Ultimate Grid MFC, Ultimate Toolbox, Ultimate Edit, and M++ math libraries.

**BCGSoft Ltd.:** For their BCGControl application framework.

**Gigasoft, Inc.:** For their ProEssentials graphing component.

**OptiCode - Dr. Martin Sander Software Development:** For their curve fitting routine in the OptiVec math library.

**Software Toolbox, Inc:** For their OPCData component and Symbol Factory image library.

**PJ Naughter:** For his tray, single instance and web server components.

**Concept Software, Inc:** For their Protection Plus copy protection.

**eHelp Corporation:** For their RoboHelp help authoring environment and tools

**Red Hat, Inc.:** For their foreign function interface code.

**Neil Hodgson:** For the scintilla code editor

Here are the copyright notices for some of the above products:

This software contains material that is © 1994-2000 DUNDAS SOFTWARE LTD., all rights reserved.

Copyright © BCGSoft Ltd. 1998-2001. All rights reserved

Copyright (C) 2001 Gigasoft, Inc. All rights reserved

Copyright © 1998-2001 OptiCode - Dr. Martin Sander Software Development

Copyright Software Toolbox, Inc., 1996-2000, All Rights Reserved Worldwide

Copyright (c) 1996 - 2001 by PJ Naughter

Copyright © 1997-2000 Concept Software, Inc.

Copyright (c) 1996-2003 Red Hat, Inc.

Copyright 1998-2003 by Neil Hodgson All Rights Reserved

And do not forget that DAQFactory, which includes DAQFactory® and associated files (including this one) are Copyright © 2001-2007 AzeoTech®, Inc. All rights reserved worldwide.

AzeoTech® and DAQFactory® are registered trademarks of AzeoTech, Inc.

The following notice is required for the Red Hat foreign function interface license:

libffi 2.00-beta - Copyright (c) 1996-2003 Red Hat, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED \`\`AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The following notice is required for the Scintilla editor:

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

## 1.4 - End User License Agreement

AzeoTech, Inc., ("AzeoTech") licenses the accompanying software to you (referred to herein as "you" or the "end user") only upon the condition that you accept all of the terms contained within this Agreement relevant to the software. Please read the terms carefully before continuing the installation, as pressing the "Yes" button will indicate your assent to them. If you do not agree to these terms, please press the "No" button to exit the install, and return the full product with

proof of purchase to AzeoTech within thirty (30) days of purchase.

I. LICENSE TERMS APPLICABLE TO ALL SOFTWARE

The following terms and conditions are applicable to any and all AzeoTech software products. The software which accompanies this Agreement is the property of AzeoTech and/or its licensors and is protected by U.S. Copyright law and state and federal trademark law, in addition to other intellectual property laws and treaties. This software is licensed to you, not sold. While AzeoTech continues to own the software, upon your acceptance of this Agreement you will have the

following specifically defined rights and obligations arising from your license:

Once you have purchased a software license from AzeoTech, you may do the following:

(a) Use only one copy of the relevant software on a single computer;

(b) Make one copy of the software for archival purposes, or copy the software onto the hard disk of your computer and retain the original for archival purposes;

(c) Use the software on a network, provided that you have a licensed copy of the software for each computer that can access the software over that network;

(d) Upon written notice to AzeoTech and your receipt of AzeoTech's written approval, transfer the software on a permanent basis to another person or entity, provided that you retain no copies of the software, and that the transferee agrees to the terms of this Agreement.

(e) If you are an entity, you may designate one individual within your organization to have the right to use the software in the manner provided herein. The software is "in use" on a computer when it is loaded into temporary memory (RAM) or installed into permanent memory (hard disk, CD-ROM, or other storage device) of that computer.

The following are strictly prohibited by this Agreement:

(a) Copying the documentation which accompanies this software;

(b) The distribution of this software or copies of this software to third parties, except as provided in Section II(A) herein regarding the distribution of copies of Evaluation Software for evaluation purposes;

(c) Sublicensing, renting or leasing any portion of this software;

(d) Reverse engineering, decompiling, disassembling, modifying, or translating the software, attempting to discover the source code of the software, or creating derivative works of the software; and

(e) Using a previous version or copy of the software after you have received a disk replacement set or an upgraded version as a replacement of the prior version. Upon upgrading the software, all copies of the prior version must be immediately destroyed.

II. LICENSING TERMS RELEVANT TO SPECIFIC SOFTWARE PRODUCTS

A. DAQFactory and DAQFactory Runtime. The following provisions apply only to the use and license of all versions of DAQFactory and DAQFactory Runtime, but shall not apply to the use and license of DAQFactory Runtime in conjunction with DAQFactory-Developer, as provided in Section II(B) below, or to the use and license of DAQFactory Express, as provided in Section II(C) below.

1. AzeoTech provides a temporary version ("Evaluation Software") of DAQFactory and DAQFactory Runtime to all potential end users for a twenty-five (25) day evaluation period. At the end of the evaluation period, the Evaluation Software automatically shuts down and ceases to work unless the end user purchases a license from AzeoTech for the full versions of the products. Upon payment, AzeoTech provides the end user with a code that allows full use of the software. If at the end of the evaluation period, you have not purchased a license to use the full version of DAQFactory or DAQFactory Runtime from AzeoTech, any continued or additional use is in violation of this Agreement and of U.S. Copyright laws.

2. You may distribute the Evaluation Software to third parties for evaluation purposes only. Such copies shall be subject to the relevant terms and conditions of this Agreement in the same manner as if distributed directly by AzeoTech.

B. DAQFactory-Developer. The following provisions apply only to the use and license of DAQFactory-Developer and the use and license of DAQFactory Runtime in conjunction with DAQFactory-Developer and all documents and applications created with DAQFactory-Developer.

1. If you have purchased a license for DAQFactory-Developer, AzeoTech grants you permission to distribute your created documents and applications, together with DAQFactory Runtime, to third parties without a licensing fee. In exchange, you agree to be bound by all of the relevant terms and conditions set forth in this Agreement.

2. All third party users and recipients of documents or applications created with DAQFactory-Developer are bound by all of the terms and conditions of this agreement, and are strictly prohibited from distributing DAQFactory Runtime absent their own purchase of a license for DAQFactory-Developer. In addition, third party users and recipients are strictly prohibited from using DAQFactory Runtime to run applications other than those created with DAQFactory-Developer, except upon their purchase of a license for DAQFactory Runtime from AzeoTech.

3. Neither you nor third party users or recipients are permitted to create generic data acquisition applications using DAQFactory-Developer that would directly compete with DAQFactory or any other AzeoTech software product. This includes, but is not limited to, generic strip chart recorders, data loggers and PID loop controllers.

C. DAQFactory Express. The following provisions apply to the use and license of DAQFactory Express, a separate software product available from AzeoTech and often provided to you in association with hardware from a hardware manufacturer. Using DAQFactory Evaluation Software and selecting the Express option during start up is considered DAQFactory and subject to the provisions in Section II(A) above.

1. If you have received DAQFactory Express in conjunction with hardware from a hardware manufacturer, your license for DAQFactory Express is provided to you free of charge, by AzeoTech, through the hardware manufacturer. This license is strictly limited to your use of DAQFactory Express in conjunction with the accompanying hardware, and this program may not be used on any computer or device which does not contain the accompanying hardware. Despite the fact that you

have not paid a licensing fee for this product, it is licensed software, subject to the relevant provisions of this Agreement. If you are a hardware manufacturer, you must enter into a separate agreement with AzeoTech to distribute DAQFactory Express licenses. DAQFactory Express cannot be distributed for free by simply including it with hardware.

2. DAQFactory Express is not "Evaluation Software" as defined in Section II(A) above, and accordingly, there is no 25 day time limit on its use and license. You are not permitted to distribute DAQFactory Express in any form to third parties, or upload this program onto the internet or a network which may be accessed by unlicensed third parties.

III. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS

A. Support Services. AzeoTech may provide you with support services related to the software. Use of support services is governed by the AzeoTech policies and programs described in on-line documentation and other materials provided by AzeoTech. Any supplemental software code provided to you as part of the support services shall be considered part of the software and shall be subject to the relevant terms and conditions of this agreement. With respect to technical information provided to AzeoTech as a part of the support services, AzeoTech may use such information for its

business purposes, including for product support and development.

B. Termination. Without prejudice to any other rights, AzeoTech may terminate this Agreement, in writing, upon your failure to comply with any of the terms and conditions of this Agreement, with such termination being effective upon your receipt of such notice. In such event, you shall immediately destroy all copies of the software and all of its component parts.

C. DISCLAIMER OF WARRANTIES. AZEOTECH EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE. THE SOFTWARE AND ANY RELATED DOCUMENTATION IS PROVIDED "AS IS" WITHOUT WARRANTY OR CONDITION OF ANY

KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE REMAINS WITH YOU. AZEOTECH DOES NOT WARRANT THAT THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR FREE. AZEOTECH HAS TAKEN PRECAUTIONS TO GUARD AGAINST COMPUTER VIRUSES, BUT DOES NOT WARRANT THAT THE SOFTWARE PROVIDED WILL BE WITHOUT ANY COMPUTER VIRUSES. YOU ASSUME ALL RESPONSIBILITY FOR ACHIEVING YOUR INTENDED RESULTS, TAKING PROPER PRECAUTIONS TO GUARD AGAINST COMPUTER VIRUSES, AND FOR THE USE AND RESULTS OBTAINED FROM THE SOFTWARE.

D. No Liability for Damages. In no event shall AzeoTech or its suppliers be liable for any damages whatsoever, including, without limitation, any special, consequential, indirect or similar damages, including damages for loss of business profits, lost data arising out of the use or inability to use the software, business interruption, loss of business information, or any other pecuniary loss, arising from or out of the use of or inability to use the AzeoTech software, even if AzeoTech has been advised of the possibility of such damage. In any case, AzeoTech's entire liability under any provision of this Agreement shall be limited to the amount actually paid by you for the software. The disclaimers and limitations set forth herein will apply regardless of whether you accept the software. Because some states/jurisdictions do not allow the exclusion or

limitation of liability for consequential or incidental damages, the above limitation may not apply to you.

E. WARNING. AZEOTECH'S SOFTWARE IS NOT DESIGNED FOR COMPONENTS OR TESTING FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH ANY APPLICATION WHERE MALFUNCTION OF HARDWARE OR SOFTWARE COULD RESULT IN INJURY OR DEATH, OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY OR DEATH. THE SOFTWARE MUST NEVER BE USED FOR ANY PURPOSE THAT, IF THE SOFTWARE FAILED, COULD CAUSE INJURY OR DEATH TO ANY PERSON. IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE CAN BE IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO THE FLUCTUATIONS IN ELECTRICAL POWER SUPPLY, COMPUTER HARDWARE MALFUNCTIONS, COMPUTER VIRUSES, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILER AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR MISUSES, OR ERRORS ON THE PART OF THE USER OF APPLICATIONS DESIGNER (THE ADVERSE FACTORS SUCH AS THE FOREGOING EXAMPLES ARE HEREAFTER TERMED "SYSTEM FAILURE"). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY OR DEATH) SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID DAMAGE, INJURY OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS. BECAUSE EACH END-USER IS CUSTOMIZED AND DIFFERS FROM AZEOTECH TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE AZEOTECH PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY AZEOTECH, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF AZEOTECH PRODUCTS WHENEVER AZEOTECH PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN, PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.

IV. COPYRIGHT

All title and copyrights in and to AzeoTech software, including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the software, any printed materials, and any copies of the software are owned by AzeoTech and its suppliers. The software is protected by U.S. Copyright laws and international treaty provisions. Therefore, you must treat the software like any other copyrighted material, subject to the terms of this

agreement.

V. U.S. GOVERNMENT RESTRICTED RIGHTS

The software and documentation are provided with restricted rights. The software may constitute "commercial computer software" or "commercial computer software documentation" as those terms are used in 48 CFR 12.212. Unless otherwise agreed, the use, duplication or disclosure of such software and documentation by U.S. Government agencies is subject to the restrictions set forth in 48 CRR 52.227-14 (ALT III), 48 CFR 52.227-19 and the Defense Federal Acquisition Regulation

Supplement (DFARS) 252.227.7013, as applicable, and the use, duplication or disclosure by the Department of Defense is subject to the restrictions set forth in 48 CFR 252.227-7013(c)(1)(ii) (Oct.1988). The manufacturer is AzeoTech, Inc., 443 Allison Street, Ashland, Oregon 97520.

VI. EXPORT RESTRICTIONS

You agree that you will not export or re-export the software, any part thereof, or any process or service that is the direct product of the software (the foregoing collectively referred to as the "Restricted Components"), to any country, person, entity, or end user subject to U.S. export restrictions. You specifically agree not to export or re-export any of the Restricted Components (i) to any country to which the U.S. has embargoed or restricted the export of goods or services,

which currently include, but are not limited to Cuba, Iran, Iraq, Libya, North Korea, Sudan, and Syria, or to any national or any such country, wherever located, who intends to transmit or transport the products back to such country; (ii) to any end user who you know or have reason to know will utilize the Restricted Components in the design, development or production of nuclear, chemical or biological weapons; or (iii) to any end user who has been prohibited from participating

in U.S. export transactions by any federal agency of the U.S. Government. You warrant and represent that neither the Bureau of Export Administration (BXA) nor any other U.S. Federal agency has suspended, revoked or denied your export privileges.

VII. GENERAL PROVISIONS

A. Entire Agreement. This Agreement contains the entire agreement of the parties, and may not be amended or modified except in writing signed by all of the parties. This Agreement supercedes any prior or contemporaneous understandings or agreements with respect to the subject matter hereof. Nothing in this Agreement shall be construed to limit any rights that AzeoTech may have under trade secret, U.S. and state trademark, copyright, patent, or other laws.

B. Non-Assignment. The end user may not assign any right or interest in this Agreement without the prior written consent of AzeoTech.

C. Divisibility. In the event that any provision of this Agreement shall be found to be invalid, unenforceable or prohibited by state or Federal law, the Agreement shall be considered divisible as to such part and all remaining provisions shall remain valid, enforceable and binding as though such part were not included in this Agreement.

D. Attorney Fees. In the event it becomes necessary for either party to file suit or instigate mediation or arbitration to enforce this Agreement or any provisions contained herein, and either party prevails in such action, then such prevailing party shall be entitled to recover, in addition to all other remedies or damages, reasonable attorney's fees and court costs incurred in the mediation, arbitration, at trial, and on appeal in such suit.

E. Choice of Law; Venue. This agreement shall be governed by the laws of the State of Oregon. Venue for all proceedings shall be in the Circuit or Federal Court for the State of Oregon, County of Jackson.

F. Contact Information. If you have any questions concerning this Agreement, or if you desire to contact AzeoTech for any reason, please email AzeoTech at support@azeotech.com.

---
language: "en"
---
# 1-Wire

This function performs 1-Wire communication. For additional information on how to use this function, please see the [1-Wire App Note](https://labjack.com/support/app-notes/1-wire)

* U3: U3 firmware v1.31 and hardware v1.30 are required for 1-Wire.

  Because the EIO lines on the U3 can be configured as either digital or analog, ensure that the I/O being used for 1-Wire sensor comm is first configured as either digital input or digital output, then use the function outlined below. For additional information on how to use this function, please see the [1-Wire App Note](https://labjack.com/support/app-notes/1-wire).

* U6: Firmware 1.17 or higher is required to use this function.

* UE9: UE9 control firmware v2.20 or later are required for 1-Wire.

|-----------|--------------|-----------------------------------------|
| Command:  |              |                                         |
| Byte      |              |                                         |
| 0         | Csum8        |                                         |
| 1         | 0xF8         |                                         |
| 2         | 0x1D         |                                         |
| 3         | 0x3C         |                                         |
| 4         | Csum16 L     |                                         |
| 5         | Csum16 H     |                                         |
| 6         | Options      |                                         |
|           |              | Bit 0: DPU Control Enable               |
|           |              | Bit 1: DPU Polarity                     |
|           |              | Bit 2: DPU Idle                         |
| 7         | Reserved     |                                         |
| 8         | Sense Pin    |                                         |
| 9         | DPU Pin      |                                         |
| 10        | Reserved     |                                         |
| 11        | ROM Function |                                         |
| 12        | ROM0 (LSB)   |                                         |
| 13        | ROM1         |                                         |
| 14        | ROM2         |                                         |
| 15        | ROM3         |                                         |
| 16        | ROM4         |                                         |
| 17        | ROM5         |                                         |
| 18        | ROM6         |                                         |
| 19        | ROM7 (MSB)   |                                         |
| 20        | Reserved     |                                         |
| 21        | Num TX       |                                         |
| 22        | Reserved     |                                         |
| 23        | Num RX       |                                         |
| 24        | TX Byte 0    |                                         |
| ...       | ...          |                                         |
| 63        | TX Byte 39   |                                         |
|           |              |                                         |
| Response: |              |                                         |
| Byte      |              |                                         |
| 0         | Csum8        |                                         |
| 1         | 0xF8         |                                         |
| 2         | 0x1D         |                                         |
| 3         | 0x3C         |                                         |
| 4         | Csum16 L     |                                         |
| 5         | Csum16 H     |                                         |
| 6         | Error Code   |                                         |
| 7         | Reserved     |                                         |
| 8         | Reserved     |                                         |
| 9         | Warnings     |                                         |
|           |              | Bit 0: No Devices Detected              |
|           |              | Bit 1: Type 1 interrupt (Not Tested)    |
|           |              | Bit 2: Type 2 interrupt (Not Supported) |
| 10        | Reserved     |                                         |
| 11        | Reserved     |                                         |
| 16        | Data 0       |                                         |
| ...       | ...          |                                         |
| 63        | Data 47      |                                         |

**Options:** This byte provides control of the dynamic pull-up.

* Bit 0: enables control of the DPU line.

* Bit 1: sets the polarity of the switch. 1 = high on the specified DIO turns the switch on.

* Bit 2: sets the idle state. 1 = DPU on while IDLE.

**Sense Pin:** This is the DIO on the LabJack that is connected to the data line of the 1-wire bus.

**DPU Pin:** This is the DIO line that will control the dynamic pull-up if enabled in the options byte.

**ROM Function:** This byte specifies the function to be performed on the 1-wire bus.

**ROM\[0:7\]:** This is the ROM of the target device or search path.

**Num TX:** This is the number of data bytes to transmit.

**Num RX:** This is the number of data bytes to receive.

Depending on the ROM function used the data returned can have different meanings. Refer to the following table for data definitions.  

|---------------------|--------------|---------------------------|----------------------|--------------------------------|
|                     |              | **Parameter**             | **Data Returned**    |                                |
| ***ROM Function:*** | ***Number*** | ***ROM***                 | ***Bytes 0-7***      | ***Bytes 8-15***               |
| **Search ROM**      | 0xF0         | List of branches to take. | Discovered ROM Code  | 1s indicate detected branches. |
| **Read ROM**        | 0x33         | None                      | ROM read from device |                                |
| **Match ROM**       | 0x55         | The specific ROM          |                      |                                |
| **Skip ROM**        | 0xCC         |                           |                      |                                |
| **Alarm Search**    | 0xEC         |                           |                      |                                |

Maxim has a 1-Wire app note which covers [Dynamic Pull-Ups](https://pdfserv.maximintegrated.com/en/an/AN244.pdf), and another on the [search algorithm](https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/187.html). There are several kinds of 1-wire temperature sensors from Maxim(DS1820, DS1821, DS1822, DS18S20, and DS18B20). The most common part is probably the [DS18B20](https://datasheets.maximintegrated.com/en/ds/DS1822.pdf). Note that these temperature sensors require about 750ms of time to resolve a temperature reading.

---
language: "en"
---
# 1-Wire (App Note)

This app note explains the operation and use of the 1-Wire bus in conjunction with LabJack products.

1-wire "overdrive" timings are not supported, only "standard" timings are supported.  
1-Wire is considered an advanced topic. A good knowledge of the protocol is recommended. Troubleshooting may require a logic analyzer or oscilloscope.

## Compatibility

* T4: All recent firmware versions.

* T7/T7-Pro: All recent firmware versions.

* T8: Firmware v1.00 or later.

* UE9: Control Firmware v2.20 or later.

* U6: Firmware v1.17 or later.

* U3: Firmware v1.31 or later.

* U12: Not supported.

## Overview of 1-Wire

The basis of 1-Wire technology is a serial protocol using a single data line plus ground reference for communication. A 1-Wire master initiates and controls the communication with one or more 1-Wire slave devices on the 1-Wire bus. Each 1-Wire slave device has a unique, 64-bit ID, which serves as its address on the 1-Wire bus. Slave devices typically operate over the voltage rage of 2.8 V to 5.25 V.

Some 1-Wire devices require a separate power supply, but many take their energy directly off of the data bus line---this is called parasitic supply. Because of this unique parasitic supply, 1-Wire is the only voltage-based digital system that works with two contacts, data and ground for half-duplex bidirectional communication.

## Using a LabJack as the Master

Before attempting communication with a 1-Wire slave through a LabJack, insure the following conditions are met:

* 1-Wire compatibility with your LabJack

* Only connect 1-Wire slave devices through EIO and CIO lines. The FIO lines have too much impedance to run 1-Wire properly\*. Because EIO and CIO lines are only accessible through the DB15 connector, it may be helpful to purchase a [CB15](https://labjack.com/catalog/cb15-terminal-board).

* Parasitic or dedicated supply? Depending on power consumption the slave device may require a dedicated supply, or if it is a parasitic device, the correct pull-up and/or pull-down resistors need to be installed on the bus. Refer to the device datasheet for appropriate connections.

After the above conditions are met, it will be possible to initiate communication with 1-Wire slaves using a LabJack as the master.

UD-series devices: The [low-level function](https://support.labjack.com/docs/1-wire.md) for 1-Wire handles byte array command/response, and can be integrated into any program that has access to the device commutation protocol (USB, Ethernet, etc.) An example in LabVIEW is detailed below. There is no high level UD Library function for 1-wire at this time.

T-series devices: The [LJM multiple value functions](https://support.labjack.com/docs/ljm-multiple-value-functions.md) make it easy to operate 1-Wire. For examples:

* LabVIEW: [LabVIEW LJM examples](https://support.labjack.com/docs/labview-for-ljm-windows-macos.md)

* C: [C/C++ LJM examples](https://support.labjack.com/docs/c-c-for-ljm-windows-mac-linux.md)

## Search Algorithm

Using multiple devices on the 1-Wire bus requires that their 64-bit ROM codes be known. The codes can be found using a search algorithm. This search will identify the ROM codes of all devices on the bus, but will not reveal any information about the order they appear on the bus (physical location). The figure below represents 3 devices, and the branching that occurs during their discovery.  
![1-wire-branching.png](https://support.labjack.com/__attachments/a_6cd87725a5ae6ded10bd1d205be863384bd0dabd4649f80f4ed504631047bf4d/1-wire-branching.png?cb=a560cea0c40267e7045c7dd56b08f151)

Each branch at a bit level denotes a difference in device ROM. These devices only have a 2-bit ROM.

Creating one of these search algorithms can be difficult, so when possible it is recommended to place a single device on the bus and use the master to identify its address. Based on design, if a 1-Wire slave device is alone on the bus, there will be no alternate branches for the master to search, so it will locate the device easily. After the device ROM is known, record it and identify the part with a marking or location.

More information on branching and search algorithms can be found in the following documents:

**Overview on MaximIC:** [http://pdfserv.maxim-ic.com/en/an/AN1796.pdf](https://support.labjack.com/__attachments/a_c49e9946c01b506fed24bc8cc204ed2390b86f0f423a8a453348f59dd2110927/an1796.pdf.md?cb=2995357b538ef792ce59b1b7cca539c4)

**Searching for ROM addresses:** [http://pdfserv.maxim-ic.com/en/an/AN187.pdf](https://support.labjack.com/__attachments/a_a0ab3d9277de384c206a6020b5b40659a80fa8addb8fd0cd9b456c31fd013927/an187.pdf.md?cb=2995357b538ef792ce59b1b7cca539c4)

## 1-Wire Example

For this example a Maxim DS1822 digital thermometer is used to demonstrate the use of 1-Wire. The U3-LV running firmware v1.31 is configured as the master, and using a CB15; the 4 DS1822 temperature probes are connected to EIO6(DIO 14)\*\*, VS, and GND. Below is a picture of the test setup.  
![setup.jpg](https://support.labjack.com/__attachments/a_ae9c9fff85722cd66cb19bf705d122459e080f87293343c6088a25f86195fd35/setup.jpg?cb=f473aa91b2187f582f977a5e444b34ba)

### Connections

Since 5V (VS) is readily available on the CB15, and the DS1822 can be powered either directly or off of the bus (parasitic), it was connected directly to VS. Based on the datasheet, when connected in this manner it is appropriate to also include a pull-up resistor on the bus line. A 4.7kΩ pull-up resistor is seen on the right side.

DS1822 datasheet: [https://datasheets.maximintegrated.com/en/ds/DS1822.pdf](https://support.labjack.com/__attachments/a_23a2e079d886144e5e88a0c5e5675b569e7186801dfa77c24a9723ecf8bf4da3/ds1822.pdf.md?cb=cbe146c9e38ced10a3793598340cfc66)

### Search ROM address

The next step is to discover the ROM codes that are factory programmed into the DS1822s. As mentioned above, it is easiest to connect a single device on the bus, then run the Read ROM command \[33h\]. The slave device will then return its 64-bit ROM. For convenience, a LabVIEW program capable of discovering ROM addresses on the 1-Wire bus can be downloaded at the bottom of the page.  

![search_individual.jpg](https://support.labjack.com/__attachments/a_5a97a58a82f1ca541d1ecebf38cf8922e1a4cf508c0344cdc42864655e3fa3dc/search_individual.jpg?cb=9731b1da0160283f9fb29f95939d6a08)  

![search_all.jpg](https://support.labjack.com/__attachments/a_adc1617486dba5b41c14bbebb645e7210f2b0d25b4a0f423d85da722b0b36fa4/search_all.jpg?cb=4a2a36ae66408f950621c782a2bf9dfb)

Due to the way that 1-Wire devices may be used in practice, like in an expansive sensor network, it was decided that a search algorithm could greatly benefit our customers. The algorithm was developed in LabVIEW 6, and uses the Search ROM command \[F0h\] to investigate all of the branches necessary to reach each slave device. Once discovered, they are stored in memory and displayed on the control window. Although only tested in the above example, the algorithm executable can be downloaded below. The subVI is also available.

### Reading The Temperature

After all of the ROM codes are known, simply use the Match ROM command \[55h\] followed by a 64-bit ROM code sequence to address a specific slave device on the bus. Before any communication can commence on the 1-Wire bus, the master will have to initiate this ROM command.

In order to capture the temperature data, one must carry out two additional command sequences; each one follows the Match ROM Command \[55h\].

1. The first is to make the temperature probe convert a temperature reading into a binary number. The Function Command for this is \[44h\], and must be issued in the first Tx data byte. See the [low-level function](https://support.labjack.com/docs/1-wire.md) reference for Tx Byte 0 location. Also set Num Tx to 1, for number of bytes to transfer.

2. The second sequence is required to read the binary temperature reading from the device memory. The associated Function Command is \[BEh\], and is also issued in the first Tx data byte. Again set Num Tx to 1, but this time it is also necessary to instruct the master to receive data. Set Num Rx to at least 2, because the first 2 bytes contain the binary temperature reading on the DS1822. Additional data can also be read from the device, see the datasheet for details.

For a complete communication description, reference *DS1822 Operation Example 1 pg.18* in the [datasheet](https://support.labjack.com/__attachments/a_23a2e079d886144e5e88a0c5e5675b569e7186801dfa77c24a9723ecf8bf4da3/ds1822.pdf.md?cb=cbe146c9e38ced10a3793598340cfc66). A simple LabVIEW program designed for reading the DS1822 can be downloaded below. Note that it will be necessary to know the ROM address of the slave probe before using the program.

## Useful Code

These downloads were developed during testing, and were referenced in this app note. Please review the app note before use. All executables will require the LabVIEW 6.0 run time engine, which can be [downloaded here](https://support.labjack.com/__attachments/a_6a252526989721e5f3925ba9150a87d54a9f4a04af85b41fc08c1ab2425c19a2/lvrte602winenglish.zip.md) (10.4 MB, save to desktop, right-click and do "extract here", run lvrteinstall.exe). SubVIs use some of the [LabVIEW LJUD archive](https://support.labjack.com/docs/labview-for-ud-windows.md), so this will need to be downloaded and the appropriate subVIs referenced.

[1Wire.vi](https://support.labjack.com/__attachments/a_bb7db32c5f7b2925097f408c18d4e65d83cab03d71fee1b86dfedab224e5c6c1/1wire.vi.md?cb=ba7211e2979a8ae3cbc04a92f8125776)

[1Wire.exe](https://support.labjack.com/__attachments/a_64831a0f3235927e8a71104504a4e364b84b57c19fa311cb51ade01feb0d2cbd/1wire.exe.md?cb=6e80348776e1761f4d7d9008c93e9eaf)

[1Wire_Search.vi](https://support.labjack.com/__attachments/a_86ac0473d0b447540b0037e57682332dc89ca406f2de4556cc3d655c50bf3026/1wire_search.vi.md?cb=1843a916af0bdbee7edce4df8361db9e)

[1 Wire Search.exe](https://support.labjack.com/__attachments/a_09b83b9ba1d52ef1477bf99fec98a2f0650a78904dadbf3042dee4f0f1970b67/1-wire-search.exe.md?cb=0be1e4832c165ef6e32426a6cfd3b024)

[Read_DS1822.vi](https://support.labjack.com/__attachments/a_241367e7d5c655baa4c13e65d6a6419cabcc7d09898fb898f5e9a4f94b66dc91/read_ds1822.vi.md?cb=e09e0d641b47b7f06d902265ef3197b4)

[Read DS1822.exe](https://support.labjack.com/__attachments/a_a8aa0639e9ec2820b68650aab2eb1c7ec3aee318176349292b0c540c4caf633e/read-ds1822.exe.md?cb=c83dd001205c633d0310661156f90668)

[1Wire_LJM.vi](https://support.labjack.com/__attachments/a_063a8540d33417f39b970f6bdd56c0f5c3655c5e8a6eab906f9d8bedfd86feae/1-wire_ljm-t-series.vi.md?cb=b17e558b0b3e3c118d4ad1d49130b384)

[1-Wire LJM Example .vi files](https://support.labjack.com/__attachments/a_5b541190c7aaa31e512a2e2c14aaa2889da2b727070960321d34a0819da343cc/1-wire-example-2016_08_19.zip.md?cb=12447580f5500dda8d8a306f2f33944c)

We also have a python examples for [UD-series](https://github.com/labjack/LabJackPython/blob/master/Examples/1-Wire/1-wire.py) and [T-series](https://github.com/labjack/labjack-ljm-python/tree/master/Examples/More/1-Wire) devices.

## Notes

\*The internal resistance on FIO lines could be reduced by changing the resistors, or using some form of dynamic pull up. We do not recommend modifying the LabJack; doing so may void your warranty.

\*\*The DIO pin is important when using the downloadable subVIs and executables, insure correct number

---
language: "en"
---
# 10.0 SGND and GND \[T-Series Datasheet\]

## SGND (T4 and T7)

![t7_sgnd.jpg](https://support.labjack.com/__attachments/a_c2f0ad8636d2e0e47bd0edbda1e3f4956e3eabab494dc72abcf3448069d0db62/t7_sgnd.jpg?cb=cec62f246701d00cec1ce0ea413df8ae)

SGND is located near the upper-left of the device. This terminal has a self-resetting thermal fuse in series with GND. This is often a good terminal to use when connecting the ground from another separately powered system that could unknowingly already share a common ground with the T4 or T7.

See the AIN, DAC, and Digital I/O [application notes](https://support.labjack.com/docs/digital-i-o-app-notes.md) for more information about grounding.

## GND

![gnd.jpg](https://support.labjack.com/__attachments/a_f8edbee9f70ed7df2602878cbee6a3999e3bfd627ee76134c7dafe1b935d337c/gnd.jpg?cb=aa8ff4445867d8fe8e7241c74fdea73e)

The GND connections available at the screw-terminals and DB connectors provide a common ground for all LabJack functions. All GND terminals are the same and connect to the same ground plane.

GND is also connected to the ground pin on the USB connector, so if there is a connection to a USB port on a hub/host (as opposed to just a power supply connection), then GND is the same as the ground line on the USB connection, which is often the same as ground on the PC chassis, which is often the same as AC mains ground.

For more information about grounding, see the [14.0 AIN](https://support.labjack.com/docs/14-0-analog-inputs-t-series-datasheet.md), [15.0 DAC](https://support.labjack.com/docs/15-0-dac-t-series-datasheet.md), and [13.0 Digital I/O](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md) sections.

The max total current that can be sunk into GND is:

`T4, T7: Max total current = 500mA - DeviceSupplyCurrent`

`T8: Max total current = 1100mA - DeviceSupplyCurrent`

For example, if the T7 needs 250mA to run, the current sunk into GND terminals should be limited to 250mA. Note that sinking substantial current into GND can cause slight voltage differences between different ground terminals, which can cause noticeable errors with single-ended analog input readings. For information about device supply current, see [9.0 VS, Power Supply](https://support.labjack.com/docs/9-0-vs-power-supply-t-series-datasheet.md).

---
language: "en"
---
# 10.1 - Configuring (Applies to UD-Series)

The counters and timers on the LabJack units are quite flexible. In order to configure them, you have to use some basic scripting, similar to the script we've seen so far. Because setting up a counter or timer typically requires setting multiple parameters, we recommend using the AddRequest() / GoOne() / GetResult() method instead of ePut (), but really its up to you. There are also several e functions you can use, namely eTCValues() and eTCConfig(), but these functions require you to define variables, so take as many, if not more steps than using AddRequest(). Internally, these functions call AddRequest() anyway, so we recommend just using AddRequest() from the start. eTCValues(), however, could be useful if you were using a number of timers and counters and not using Channels to store the results, but that is beyond the scope of this guide.

---
language: "en"
---
# 10.2 - Reading Values for Counters and Input Timers (Applies to UD-Series)

Reading the values of counters and timers can of course be done with script as well, using the LJ_ioGET_COUNTER and LJ_ioGET_TIMER commands. However, you can also use channels, which will perform the same command for you. If you create a new channel like you did for analog inputs, but select either the Timer or Counter I/O Type, DAQFactory will query the timer or counter value at the interval you specified. You still need to initialize and configure your timer or counter in script, but once configured you can use these two I/O types to perform the reads.

---
language: "en"
---
# 10.3 - Basic Counter and Timer Setup (Applies to UD-Series)

To use the LabJack timers or counters you need to do some very basic setup.

**Note:** to enable this guide and the corresponding samples to work with all LabJacks, we use the System Clock (tcSYS) and a PIN_OFFSET of 4. Depending on your hardware, you should feel free to use other clocks and other pin offsets.

First, by default, once you enable a timer or counter, it will replace FIO0. If you'd prefer to keep FIO0 for analog or digital I/O, you can use the LJ_chTIMER_COUNTER_PIN_OFFSET, to select a different pin:

`AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 1, 0, 0) `

The above, after a GoOne(ID), will set put the first enabled timer or counter on FIO1 instead of FIO0. The general form of the command is:

`LabJack ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, FIO pin`

`# for first timer/counter, 0, 0`

Please note that as of hardware revision 1.3 of the U3, timers and counters will start at pin offset 4. Therefore a pin offset of 0 to 4 will all result in FIO4 being the first timer. A pin offset of 5 will result in FIO5 being the first timer. FIO0 through FIO3 will no longer be usable as timers or counters.

## Counters:

To use counters, all you really need to do is enable the counter. This is done with LJ_ioPUT_COUNTER_ENABLE:

`AddRequest(ID, LJ_ioPUT_COUNTER_ENABLE,0,1,0,0) `

This will enable the first counter. To disable, do the same thing, but change the 1 to a 0. The general form of this command is:

`Labjack ID, LJ_ioPUT_COUNTER_ENABLE, Counter #, Enable (1) or Disable (0), 0, 0 `

Once the counter is enabled, you can read the counter using a channel, putting the ID in for the D#, select an I/O type of Counter, and putting the counter number for the channel number. If you are looking for the number of counts in a certain time period, please make sure and read the next section on resetting the counter.

Sample file: **LJGuideSamples\\BasicCounter.ctl**

### Timers:

Timers are slightly more complicated, mainly because they are a lot more flexible. There are a number of different timer modes and each has its own parameters and setup which is described in the following sections. A few common points though:

Like counters, you'll need to first enable the timers. The function to do so is very similar to counters except you are specifying how many timers to enable rather than enabling a specific timer. So, to enable two timers:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 2, 0, 0) `

After you have enabled the timers, you'll need to set which mode you'd like to use for each timer. For example:

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmPWM8, 0, 0)`

will set the Timer mode of timer 0 to PWM8. The general form of this command is:

`LabJack ID, LJ_ioPUT_TIMER_MODE, Timer #, Timer mode code, 0, 0 `

Possible Timer modes as of this writing include:

`LJ_tmPWM16 // 16 bit PWMLJ_tmPWM8 // 8 bit PWMLJ_tmRISINGEDGES32 // 32-bit rising to rising edge measurementLJ_tmFALLINGEDGES32 // 32-bit falling to falling edge measurementLJ_tmDUTYCYCLE // duty cycle measurementLJ_tmFIRMCOUNTER // firmware based rising edge counterLJ_tmFIRMCOUNTERDEBOUNCE // firmware counter with debounceLJ_tmFREQOUT // frequency outputLJ_tmQUAD // QuadratureLJ_tmTIMERSTOP // stops another timer after n pulsesLJ_tmSYSTIMERLOW // read lower 32-bits of system timerLJ_tmSYSTIMERHIGH // read upper 32-bits of system timerLJ_tmRISINGEDGES16 // 16-bit rising to rising edge measurementLJ_tmFALLINGEDGES16 // 16-bit falling to falling edge measurement`

Not all modes may be supported by all LabJacks. Please see the file LabJackUD.h in your LabJack installation directory for any new modes.

Finally, you'll probably need to set the clock base and divisor that the timer will use:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc24MHZ_DIV, 0, 0) `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 24, 0, 0) `

These both follow the standard form of PUT_CONFIG:

`LabJack ID, LJ_ioPUT_CONFIG, Parameter, Value, 0, 0 `

The clock divisor is an integer. For timer base, there are several constants defined:

`LJ_tc750KHZ // UE9: 750 khzLJ_tcSYS // UE9: system clockLJ_tc2MHZ // U3: Hardware Version 1.20 or lowerLJ_tc6MHZ // U3: Hardware Version 1.20 or lowerLJ_tc24MHZ // U3: Hardware Version 1.20 or lowerLJ_tc500KHZ_DIV // U3: Hardware Version 1.20 or lowerLJ_tc2MHZ_DIV // U3: Hardware Version 1.20 or lowerLJ_tc6MHZ_DIV // U3: Hardware Version 1.20 or lowerLJ_tc24MHZ_DIV // U3: Hardware Version 1.20 or lowerLJ_tc4MHZ // U3: Hardware Version 1.21 or higherLJ_tc12MHZ // U3: Hardware Version 1.21 or higherLJ_tc48MHZ // U3: Hardware Version 1.21 or higherLJ_tc1MHZ_DIV // U3: Hardware Version 1.21 or higherLJ_tc4MHZ_DIV // U3: Hardware Version 1.21 or higher `

`LJ_tc12MHZ_DIV // U3: Hardware Version 1.21 or higherLJ_tc48MHZ_DIV // U3: Hardware Version 1.21 or higher`

Once again, not all clock bases are supported by all LabJacks and you should check the LabJackUD.h file for any new bases.

---
language: "en"
---
# 10.4 - Resetting Counters (Applies to UD-Series)

A common use for counters is to count the number of events that occur within a preset time, often within a second. In these cases, it is tempting to reset the counter after each interval. This, however, is not recommend because every time you reset the counter there is a very short dead period where no counts can be measured. At higher count rates you can easily miss counts. To avoid this, you should use the power of DAQFactory to calculate the difference between two consecutive readings to get a counts per interval reading rather than resetting the counter.

To do this, you will need two channels. First, we'll assume you have properly initialized your counter as described in the previous section. You also probably should reset the counter at startup using:

`AddRequest(ID, LJ_ioPUT_COUNTER_RESET,0,1,0,0) `

where the first 0 is the counter number to reset, in this case the first counter.

1) Create a channel to read the counter. Call it RawCounts or similar. This will be Device Type = LabJack of course, D# = LabJack ID, I/O Type of Counter, Channel # = desired counter or 0 on devices with only one counter. Set the Timing to whatever your desired interval is. For counts per second, put 1.00.

2) Create a second channel that will hold your counts per interval. Call it Counts for now. This channel will be **Device Type** = Test, **D#** = 0, **I/O Type** = A to D, **Channel #** = 0, and most importantly, **Timing** = 0. Click **Apply** to save your new channels.

3) Click on the **+** next the **CHANNELS:** in the Workspace, then click on the **RawCounts** channel. When the channel view appears, click on the **Event** tab. Enter the following script:

`Counts.AddValue(RawCounts[0] - RawCounts[1]) `

4) Click **Apply** . At this point, provided RawCounts is actually getting increasing counts, the Counts channel will have the interval counts. You can click on the **Table** tab to see this (after clicking on **Counts** in the Workspace).

The problem with the above method is that it doesn't account for counter roll over. On a 32 bit counter this happens at just over 4 billion counts, so before worrying about this, you might want to figure out how long it would take to accumulate that many counts and see if its worth worrying about. Remember that if you reset the counter at startup, you only have to worry about the amount of time DAQFactory is continuously running. If rollover does occur, all you will see is a single, negative interval counts measurement. You can post-calc the correct measurement by simply adding 4294967296 to this negative number. That is 2 raised to the 32 power. But, if you don't want negative counts on rollover, you just have to change the Event from step 3 slightly:

`if (RawCounts[0] > RawCounts[1]) `

` Counts.AddValue(RawCounts[0] - RawCounts[1]) `

`else `

` Counts.AddValue(RawCounts[0] - RawCounts[1] + 2^32) `

`endif `

Of course if you have a 16 bit counter, you'll need to change the 32 to 16 so it adds 65536 instead.

## Hertz measurements:

Finally, if instead of actual counts in an interval, you want a hertz measurement (counts per second), we just change the AddValue() lines to divide by the difference in time:

`if (RawCounts[0] > RawCounts[1]) `

` Counts.AddValue((RawCounts[0] - RawCounts[1]) / (RawCounts.Time[0] - RawCounts.Time[1])) `

`else `

` Counts.AddValue((RawCounts[0] - RawCounts[1] + 2^32) / (RawCounts.Time[0] - RawCounts.Time[1])) `

`endif `

The nice part about this is that if DAQFactory gets delayed a few milliseconds before doing the read, the hertz measurement will be properly normalized.

Sample file: **LJGuideSamples\\BasicCounter.ctl**

---
language: "en"
---
# 10.5 - Setting Up Specific Timer Modes (Applies to UD-Series)

The U3, U6, and UE9, all use the same timer/counter system, but some details are unique to each device to consult the user's guide for each. The number of timers/counters available for the U3, U6, and UE9, are 2/2, 4/2, and 6/2. The UE9 has different timer clock options than the U3 and U6. The UE9 does not support pin-offset, so the timers/counters always start at FIO0.

## 10.5.1 PWM Out

There are two timer / counter modes for pulse width modulation (PWM), one is 16 bit, the other 8 bit. These, and the available timer clocks are described in your LabJack User's manual and vary depending on the device. The setup, however, is largely the same. Here's some sample script for setting up and starting a PWM8 on FIO4. As always, we assume you've done using() and include() someplace else and defined ID appropriately:

`//Set the timer/counter pin offset to 4, which will put the first timer/counter on FIO4. `

`AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0, 0) `

`//Use the 48 Mhz with divisor timer clock base (U3 or U6). `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0) `

`//Set the divisor to 48 so the resulting timer clock is 1 MHz.`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 48, 0, 0) `

`//Enable 1 timer.`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

`//Configure Timer0 as 8-bit PWM. Frequency will be 1M/256 = 3906 Hz. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmPWM8, 0, 0) `

`//Set the PWM duty cycle to 50%. `

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 32768, 0, 0) `

`//Execute the requests. `

`GoOne(ID) `

We've explained most of these commands already. The only one new is the LJ_ioPUT_TIMER_VALUE. This sets the PWM duty cycle. Even though we are using an 8 bit PWM, this takes a 16 bit number. 32768 is half way into a 16 bit unsigned integer, so this results in a 50% duty cycle PWM. The general form of this command is:

`LabJack ID, LJ_ioPUT_TIMER_VALUE, Timer #, Value, 0, 0 `

The two modes are:

`LJ_tmPWM8 `

`LJ_tmPWM16 `

Sample file: **LJGuideSamples\\TimerPWM.ctl**

## 10.5.2 Period In

There are four Timer modes that allow you to measure the number of clock cycles between consecutive rising or falling edges. Two 16 bit, and two 32 bit. Using these modes is just a matter of performing all the basic steps we've described:

1) Enable a Timer:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

2) Set the mode:

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmRISINGEDGES32, 0, 0) `

The four modes are:

`LJ_tmRISINGEDGES32 `

`LJ_tmFALLINGEDGES32 `

`LJ_tmRISINGEDGES16 `

`LJ_tmFALLINGEDGES16`

Note the plural form of Edge!

3) Set the clock frequency and divisor:

`// use system clock so it works on U3, U6 and UE9: `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tcSYS, 0, 0)`

4) GoOne() to actually execute the commands:

`GoOne(ID) `

5) Create a channel to read the Timer. **I/O Type** is Timer, **Channel #** is the timer #, in this case 0.

The difference between the rising and falling edge versions of these modes is self explanatory. The 32 bit versions allow you to measure longer lengths with higher clock frequencies, and thus higher resolution for long periods, but are subject to small errors because it is interrupt driven. If your lengths are short enough that the edges will always occur within 65535 clock cycles, you should use the 16 bit versions as they are not subject to the interrupt errors.

If you want to read the timer from script, you can use LJ_ioGET_TIMER:

`private datain `

`eGet(ID, LJ_ioGET_TIMER, 0, @datain, 0)`

Sample file: **LJGuideSamples\\TimerPeriodIn.ctl**

## 10.5.3 Duty Cycle In

Duty cycle in is similar to setup as period in. The difference is that duty cycle in returns two values, the number of clock cycles the signal is high and the number of cycles the signal is low packed into one 32 bit number. These two values, therefore, are 16 bit, so you'll need to pick a clock frequency and divisor that won't overflow the 65535 counts possible. Setting up these modes is just a matter of performing all the basic steps we've described:

1) Enable a Timer:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

2) Set the mode:

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmDUTYCYCLE, 0, 0) `

3) Set the clock frequency and divisor:

`// use 48MHz clock base with divisor = 48 to get 1 MHz timer clock: `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0)`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 48, 0, 0) `

4) GoOne() to actually execute the commands:

`GoOne(ID) `

5) Create a channel to read the Timer. **I/O Type** is Timer, **Channe** l # is the timer #, in this case 0.

The tricky part is actually parsing the data, since it is actually two different values packed into one number. The best way to do this is similar to the way we dealt with resetting counters, by creating extra, psuedo-channels to store the parsed data:

6) Create two more channels, one called **TimeHigh** , one called **TimeLow** . **Device Type** is Test,**D#** = 0, **I/O Type** = A to

D, **Chan #** = 0 and most importantly, **Timing** = 0.

7) Click **Apply** to save your new channels, then click on the **+** next to **CHANNELS:** in the Workspace, then click on your Timer channel. We'll assume you called that channel RawDuty.

8) Click on the **Event tab** when the Channel view appears. Enter the follow script to parse the timer reading and click **Apply** :

`TimeHigh.AddValue(RawDuty[0] % 0x10000) // LSW `

`TimeLow.AddValue(floor(RawDuty[0] / 0x10000)) // MSW `

This will split the single 32 bit reading into two separate readings and place them in their own channels.

Sample file: **LJGuideSamples\\TimerDuty.ctl**

## 10.5.4 Firmware Counter In

This Timer mode works similar to a counter, but uses an interrupt routine to increment the counter so can't handle real high speed counts, and has a bit more internal overhead than a regular counter. Setting it up is basically the same as period in:

1) Enable a Timer:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

2) Set the mode:

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmFIRMCOUNTER, 0, 0) `

3) GoOne() to actually execute the commands:

`GoOne(ID) `

4) Create a channel to read the Timer. **I/O Type** is Timer, **Channel #** is the timer #, in this case 0.

You can reset the timer to 0 by using LJ_ioPUT_TIMER_VALUE, put please read the section on resetting counters and how to get around it.

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 0, 0, 0) `

Sample file: **LJGuideSamples\\TimerFirmCount.ctl**

## 10.5.5 Firmware Counter In with Debounce

This Timer mode works the same as Firmware Counter In, but introduces a debounce circuit for mechanical switch

counting. It is really designed for frequencies less than 10hz, mostly push-button and reed-switch detection. Setting it up is similar to the regular Firmware Counter In, but has some extra steps to set the debounce settings:

1) Enable a Timer:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

2) Set the mode:

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmFIRMCOUNTERDEBOUNCE, 0, 0) `

3) Set the debounce settings to a single 87ms period, positive edges counted:

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 257, 0, 0) `

4) GoOne() to actually execute the commands:

`GoOne(ID) `

6) Create a channel to read the Timer. **I/O Type** is Timer, **Channel #** is the timer #, in this case 0.

You can reset the timer to 0 by using LJ_ioPUT_TIMER_VALUE, put please read the section on resetting counters and how to get around it.

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 0, 0, 0)`

Sample file: **LJGuideSamples\\TimerFirmCount.ctl**

## 10.5.6 Frequency Out

Frequency out is similar to PWM, but outputs a 50% duty cycle square wave. Because its fixed at 50% duty, a wider range of frequencies are attainable. Setup is similar to PWM, except the Timer value we specify is another divisor for the clock:

`//Set the timer/counter pin offset to 4, which will put the first timer/counter on FIO4. `

`AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0, 0) `

`// use 48MHz clock base with divisor = 48 to get 1 MHz timer clock: `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0)`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 48, 0, 0) `

`//Enable 1 timer.`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) `

`//Configure Timer0 as Frequency out.`

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmFREQOUT, 0, 0) `

`//Set the second divisor to 5 (x2), yielding a frequency of 100khz `

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 5, 0, 0) `

`//Execute the requests. `

`GoOne(0) `

Sample file: **LJGuideSamples\\TimerFreqOut.ctl**

## 10.5.7 Quadrature

The quadrature Timer mode is designed explicitly for use with quadrature encoders. A quadrature encoder is a device that allows you to determine the absolute position of a rotating shaft. It does this by generating two pulses with each part of a rotation (how small of a rotation a "part" is depends on the encoder). One pulse will come before the other if the shaft is rotating in one direction, and the pulse order is flipped if the shaft is rotating in the other direction. The LabJack quadrature timer reads both these pulses and increments or decrements the timer reading depending on which pulse occurs first.

Because it takes two pulse signals coming in on two wires, the quadrature mode requires two timers, even though there is only one reading. The two timers have to be adjacent pairs, with the even timer as quadrature channel A, and the odd timer as quadrature channel B. Reading either timer returns the same, signed 32 bit count, and writing a zero to either timer resets both. Here's some DAQFactory script to initialize the quadrature mode on timers 0 and 1:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 2, 0, 0) `

`//Configure Timer0 as quadrature. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmQUAD, 0, 0) `

`//Configure Timer1 as quadrature. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 1, LJ_tmQUAD, 0, 0) `

`GoOne(ID) `

As you can see, its one of the easier timers to setup since it doesn't require the internal clock. The easiest way to read the timer is to create a Timer channel: I/O Type is Timer, Channel # is the timer #, in this case 0, Timing can be whatever update interval you would like. Alternatively, you can use LJ_ioGET_TIMER to retrieve the reading from script:

`private datain `

`eGet(ID, LJ_ioGET_TIMER, 0, @datain, 0)`

## 10.5.8 Timer Stop

Timer stop allows you to stop a particular (even numbered) timer after a certain number of pulses is received on the odd numbered timer stop timer pin. This is especially useful when used with frequency or PWM out to drive a stepper motor a certain number of pulses. For example, to generate exactly 1000 pulses on Timer 0, we'd setup timer 0 as frequency out, and timer 1 in timer stop mode and tie the two output pins together. You'll recognize the first part from the frequency out section:

`//Set the timer/counter pin offset to 0, which will put the first timer/counter on FIO0. `

`AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 0, 0, 0)`

`// use 48MHz clock base with divisor = 48 to get 1 MHz timer clock: `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0)`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 48, 0, 0) `

`//Enable 2 timers.`

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 2, 0, 0)`

`//Configure Timer0 as Frequency out. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmFREQOUT, 0, 0)`

`//Set the second divisor to 5, yielding a frequency of 100khz `

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 0, 5, 0, 0) `

`//Configure Timer1 as timer stop:`

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 1, LJ_tmTIMERSTOP, 0, 0)`

`// set number of pulses: `

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 1, 1000, 0, 0)`

`//Execute the requests. `

`GoOne(0) `

Once the 1000 pulse are complete, Timer 0 will stop. To restart it, you'll need to reconfigure the timers by simply rerunning the above script.

Add a digital line to control the direction and you have a very easy stepper controller. But if you want it even easier, you can use a Channel event to allow a channel to trigger the pulses. To do this:

1) Create a sequence called PulseOut with the above script, replacing the 1000 in the last AddRequest with NumPulses\[0\]:

`.... `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 1, LJ_tmTIMERSTOP, 0, 0) `

`// set number of pulses: `

`AddRequest(ID, LJ_ioPUT_TIMER_VALUE, 1, NumPulses[0], 0, 0) `

`....`

2) Create a new channel, call it NumPulses. **Device Type** = Test, **D#** = 0, **I/O Type** = D to A, **Chan #** = a unique number (if you are using more than 1 Test D/A channel). Click **Apply** .

3) Click on the **+** next to **CHANNELS:** in the Workspace if not already expanded and click on the **NumPulses** channel.

4) Click on the **Event** tab, and put this script in:

`beginseq(PulseOut) `

Now, you can use the various DAQFactory components to simply set the NumPulses channel and the desired length pulse train will be outputted. Just remember that sliders and knobs will continuously update this channel and so are not good for changing NumPulses since the pulse train will likely take longer than the update speed. You can also change NumPulses in script:

`NumPulses = 500 `

Just remember that as soon as NumPulses is set, the pulse train will start.

Sample file: **LJGuideSamples\\TimerStop.ctl**

## 10.5.9 System Timer In

This mode allows you to read the free-running internal 64 bit system timer. The frequency of this timer is 750khz for the UE9 and 4MHz for the U3. Since DAQFactory's clock is precise to 1 microsecond (1 MHz), and there is a built in latency of a few milliseconds to actually read the LabJack, there are really only two uses for this timer. The first is when doing triggered stream. Here, DAQFactory has no way of determining the time of each scan, so we can use the system timer to apply a high precision time stamp as long as we include the timer in the stream. This is described in the section on Triggered Streaming.

The other use is when you need a high precision time stamp on another timer or counter read. Since all the timer and counter reads are done with a single call to the device, there is no software latency if the desired timers and the timer setup as system timer are read at the same time. This is as simple as making sure all your LJ_ioGET_TIMER_VALUE requests are together. This can also be achieved if you are using Channels to retrieve your timer readings as long as your timers all have the same Timing and Offset.

Depending on how long your experiment runs, you may be able to get away with only SYSTIMERLOW. For the UE9 at 750khz, the low timer will roll over every 5726 seconds, while the U3 at 4MHz rolls over in 1073 seconds. Here's the script to do both low and high system timers for longer experiments:

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 2, 0, 0) `

`//Configure Timer0 as timer low. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmSYSTIMERLOW, 0, 0) `

`//Configure Timer1 as timer high. `

`AddRequest(ID, LJ_ioPUT_TIMER_MODE, 1, LJ_tmSYSTIMERHIGH, 0, 0) `

`GoOne(ID) `

Of course you'll probably have more than 2 timers enabled, or perhaps a counter or two.

If you actually need the high double-word of the system timer, you are going to end up with the time spread across two channels. You'll have to combine them. The easiest way is probably to use a calculated V channel. Here's how to do it, plus convert the counts to actual seconds:

1) Right click on **CHANNELS:** under **V:** in the Workspace and select **Add V Channel** . Give it a name, such as **LJSystemClock** .

2) In the Expression area enter the following and click Apply:

`(SysTimerLow + SysTimerHigh << 32) / 4e6 `

This assumes you named your timer channels SysTimerLow and SysTimerHigh. It also assumes a U3 with a 4Mhz clock. For the UE9, change the 4e6 (4 million) to 750e3 (750 thousand).

You can now use this V channel anywhere you would a regular channel. You just have to prepend V. in front of the channel name:

`V.LJSystemClock`

` `

Sample file: **see Triggered Streaming**

Please note that DAQFactory uses 64 bit double precision floating point for all numbers. This representation has 52 bits of precision on the integer side, so you can only really store up to 52 bits of this counter. As the counter gets above 252, you will lose precision in the low order bits.

---
language: "en"
---
# 10 - Counters and Timers (Applies to UD-Series)

**Subsections**

* [10.1 - Configuring](https://support.labjack.com/docs/10-1-configuring-applies-to-ud-series.md)
* [10.2 - Reading Values for Counters and Input Timers](https://support.labjack.com/docs/10-2-reading-values-for-counters-and-input-timers-.md)
* [10.3 - Basic Counter and Timer Setup](https://support.labjack.com/docs/10-3-basic-counter-and-timer-setup-applies-to-ud-s.md)
* [10.4 - Resetting Counters](https://support.labjack.com/docs/10-4-resetting-counters-applies-to-ud-series.md)
* [10.5 - Setting Up Specific Timer Modes](https://support.labjack.com/docs/10-5-setting-up-specific-timer-modes-applies-to-ud.md)

---
language: "en"
---
# 11.0 SPC \[T-Series Datasheet\]

## Overview

The SPC terminal has several uses:

Outputs diagnostic timing signals while streaming (see [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) for details).

Can be used to force special boot-up behavior such as Factory Reset or Boot to Emergency Firmware.

## Operation

You can monitor Stream timing by connecting a wire to the SPC pin and reading the pulses.

To force special boot-up behavior, securely install a short jumper wire from SPC to one of the corresponding I/O lines described below. The jumper needs to be installed before reset, so make sure the jumper is securely clamped in SPC and the given FIO or AIN terminal, then power up the device.

The jumper must be [**securely installed**](https://support.labjack.com/docs/screw-terminals-app-note.md). Don't try to just hold a wire in a loose screw terminal or touch a wire to the screw head. The LEDs blink in an alternating pattern 5 times to confirm that the jumper was detected.

## Boot-up Behavior

There are five special boot-up behaviors:

* **Force Boot to Main Firmware** - Force boot to main firmware (internal) image. Used to boot the internal firmware even if its checksum is bad. Additionally, Lua scripts will not be loaded during boot up.

* **Force Overwrite Main Firmware** - Force copy of backup image to overwrite internal image. Used to load the external firmware even if its checksum is bad.

* **Factory Reset** - Sets the start up configuration to factory settings. Disables Lua script at boot-up.

* **Boot to Emergency Firmware** - Load emergency image. This option loads a firmware image with minimal functionality (similar to Windows safe-mode). Used to recover from firmware corruption or bugs. The update process is about all that can be done while in this mode.

* **Configure Static Ethernet** - Temporarily sets the Ethernet configuration with DHCP turned off and factory settings for IP Address, Subnet, Gateway, DNS, and Alternate DNS. This is temporary and does not overwrite the _DEFAULT ethernet settings.

This static Ethernet configuration is compatible with a [direct Ethernet connection](https://support.labjack.com/docs/direct-connection-via-ethernet-app-note.md).

## SPC Jumpers By Device

T4  

|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| FIO4 | Force Boot to Main Firmware                                                                                                                                                                                                      |
| FIO5 | Force Overwrite Main Firmware                                                                                                                                                                                                    |
| FIO6 | Factory Reset                                                                                                                                                                                                                    |
| FIO7 | Boot to Emergency Firmware                                                                                                                                                                                                       |
| AIN3 | Configure Static Ethernet (Added in firmware 1.0027). Temporarily sets the Ethernet configuration as follows: DHCP: Off IP Address: 192.168.1.214 Subnet: 255.255.255.0 Gateway: 192.168.1.1 DNS: 8.8.8.8 Alternate DNS: 8.8.4.4 |

T7  

|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| FIO0 | Force Boot to Main Firmware                                                                                                                                                                                                      |
| FIO1 | Force Overwrite Main Firmware                                                                                                                                                                                                    |
| FIO2 | Factory Reset                                                                                                                                                                                                                    |
| FIO3 | Boot to Emergency Firmware                                                                                                                                                                                                       |
| AIN3 | Configure Static Ethernet (Added in firmware 1.0291). Temporarily sets the Ethernet configuration as follows: DHCP: Off IP Address: 192.168.1.217 Subnet: 255.255.255.0 Gateway: 192.168.1.1 DNS: 8.8.8.8 Alternate DNS: 8.8.4.4 |

T8  

|------|-------------------------------|
| FIO0 | Force Boot to Main Firmware   |
| FIO1 | Force Overwrite Main Firmware |
| FIO2 | Factory Reset                 |
| FIO3 | Boot to Emergency Firmware    |

## Device Recovery Process

If the device has become unresponsive, we recommend trying the following sequence of our device SPC jumpers, stopping if the device becomes responsive:

1. Factory reset

2. Force copy of backup image to overwrite internal image.

3. Load emergency image. You should update your device firmware using our Kipling software after loading the emergency image.

## Firmware Images

T-Series devices have two different firmware images:

* The "primary firmware image", which is synonymous to "main firmware", is the firmware image used when the device is working properly. The primary firmware image (when being used) exists in the microcontroller's internal flash (for execution) as well as on the external flash chip as a backup image.

* The second firmware is known as the "Emergency Image." The Emergency Image implements a minimal feature set, which is enough to update the main firmware.

---
language: "en"
---
# 11.1 - Opening A LabJack Manually (Applies to UD-Series)

There may be applications, most likely ones running in the Runtime version of DAQFactory, where you do not know the ID or address of the LabJack when creating the application and so can't hard code this in. Because of this, the LabJack driver has a function to allow you to manually open a LabJack, returning a device number that you can use with the rest of the functions just like before. For example, to open a UE9 at Ethernet address 192.168.2.1, you might do:

`global DNum `

`private err `

`err = OpenLabJack(LJ_dtUE9, LJ_ctETHERNET, "192.168.2.1", 0, @DNum) `

`if (err != LJE_NOERROR) `

` // failed to open `

`endif `

This of course assumes you've done your using() and include() calls elsewhere already. In this example we used static parameters, but there is no reason you couldn't replace any or all of the parameters with variables that could be edited by the end user from pages you created.

Once successfully called, you should then use the DNum variable in all your other LabJack function calls.

A few points:

* There is no way to close a LabJack. This is handled automatically when you quit DAQFactory. That said, you don't want to go randomly opening LabJacks that don't exist as each attempt will use a little memory that can't be recovered until you quit DAQFactory.

* If you call OpenLabJack() with the exact same parameters, the function will not reopen the LabJack, but rather will return Device Number of the previously opened LabJack. Of course if the first call to OpenLabJack() failed, it will try again.

---
language: "en"
---
# 11.2 - Raw In/Out and Other Functions That Require Array Pointers (Applies to UD-Series)

The Raw In and Raw Out functions (LJ_ioRAW_IN, LJ_ioRAW_OUT), and several other functions of the LabJack require an array pointer. You can pass a pointer to an array, just like you've been passing references to variables, using the @ sign. Just make sure you have preinitialized the array to the correct amount. So, using the example in the LabJack User's Guide for Raw In and Out, the DAQFactory script would look like this (assuming first found and that you've done the using() and include() somewhere else):

`private writeArray = {0x70,0x70} `

`private readArray = {0x00,0x00} `

`private NumBytesToWrite = 2 `

`private NumBytesToRead = 2 `

`eGet(0, LJ_ioRAW_OUT, 0, @NumBytesToWrite, @writeArray) `

`eGet(0, LJ_ioRAW_IN, 0, @NumBytesToRead, @readArray) `

Internally, DAQFactory will convert the array of double precision values, which is the only numeric data type supported in DAQFactory, to an array of bytes. This means that each element in the array should be between 0 and 255. The array also must be 1 dimensional. Most importantly, the array **MUST** be preinitialized to the proper length. The driver does not look at the previous parameter to make sure you have the correct array size, any more than the C version would do. If you do not preinitialize, you are likely to crash DAQFactory. Worse, it may work sometimes, but crash others, so be careful with this one.

---
language: "en"
---
# 11.3 - SPI Communications (Applies to UD-Series)

LabJack devices support serial communications using their digital lines using the standard SPI synchronous format. This is a powerful but advanced feature of the LabJack, though the details of SPI are beyond the scope of this guide.

Following is sample code that demonstrates SPI usage. It uses:

* FIO0 for the clock (CLK),

* FIO1 for CS,

* FIO2 for MOSI, and

* FIO3 for MISO.

The code sends out a string of 16 bytes and prints the received string to the command / alert window. If you short MISO to MOSI, then the 16 bytes sent out are echoed back. If MISO is tied to GND, then all zeros are received and printed. If you tie MISO to VS or leave it unconnected, then all 255's are received and printed.

`using("device.labjack") `

`include("c:\program files\labjack\drivers\labjackud.h") `

`global ID = 0 // use first found `

`//First, we do a pin config reset to set the LabJack to factory defaults. `

`ePut(ID,LJ_ioPIN_CONFIGURATION_RESET,0,0,0) `

`// Configure the SPI communication: `

`//Enable automatic chip-select control. `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_AUTO_CS,1,0,0) `

`//Mode A: CPHA=0, CPOL=0. `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_MODE,0,0,0) `

`//125kHz clock. `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_CLOCK_FACTOR,0,0,0) `

`//MOSI is FIO2 `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_MOSI_PIN_NUM,2,0,0) `

`//MISO is FIO3 `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_MISO_PIN_NUM,3,0,0) `

`//CLK is FIO0 `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_CLK_PIN_NUM,0,0,0) `

`//CS is FIO1 `

`AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSPI_CS_PIN_NUM,1,0,0) `

`//Execute the requests on a single LabJack. The driver will use a single low-level TimerCounter command to hand `

`GoOne(ID) `

`// now that its setup, do the communication. Note that you can do this part in a separate sequence, and run mul `

`// without the reconfiguring the SPI with the above code. `

`// initialize the variables `

`private numSPIBytesToTransfer=4 `

`private dataArray `

`dataArray[0] = 170 `

`dataArray[1] = 138 `

`dataArray[2] = 85 `

`dataArray[3] = 21 `

`//Transfer the data. The write and read is done at the same time. `

`eGet(ID, LJ_ioSPI_COMMUNICATION, 0, @numSPIBytesToTransfer, @dataArray) `

`// print the read to the command / alert window. Of course you'll probably do something a bit more exciting wit `

`? dataArray`

Each time you run the script, the 4 bytes of dataArray will be written and then 4 bytes will be read back and printed to the command / alert window. As mentioned in the script comments, you can do the actual communication multiple times without re-running reconfiguration script at the top of this sample.

Note that the [UD example code](https://support.labjack.com/docs/c-c-vc6-for-ud-windows.md) provides similar code to the above script in C.

---
language: "en"
---
# 11.4 - Utilizing Multicore Processors (Applies to UD-Series)

In many places in this guide, we've split apart things that occur at less than 100hz, and those that are faster. This is because Windows needs to have some CPU time to redraw the screen, move the mouse and perform other tasks and thus can't really do things at an interval faster than 100hz.

However, if you have a multicore or multiprocessor computer, you can take advantage of DAQFactory's design and the multiple cores to achieve faster software polled rates than would be possible with a single core. The trick to this is making sure that all your fast processes, i.e. anything faster than 50hz or so, is done in a single thread.

What's a thread? You've seen Windows do multiprocessing before when you are downloading a big file off the internet and you switch to another program to check your email at the same time. A thread is just like different programs that can run simultaneously, but that exist inside of a single program like DAQFactory. DAQFactory is made up of a lot of different threads and so can perform multiple tasks simultaneously. Likewise, it can split these threads across multiple cores or processors for maximum efficiency.

There are basically two ways you can keep things on a single thread in DAQFactory. The first is to put all the tasks in a single sequence. Each sequence is run in its own thread, unless of course it is called as a function from another sequence. This is why you can create multiple sequences to perform different tasks and run them all simultaneously. The other way is to create Channels, and give all the desired high speed channels the same Timing and Offset values. If Channels have different Timing or Offset, then they are put on a different thread.

If you have multiple processors or cores and want to see this in action, just create a few analog input channels and set their Timing to 0.001. This will chew up much of the processor power of one of your cores, but will leave Windows the other core to perform its tasks. In fact, as I am typing this, I have DAQFactory running reading an analog input from a LabJack at full speed, and I see no lag in my typing.

That all said, its important to understand that there is a limit to how fast the LabJack itself can process commands. If you perform the test with a few Channels with Timing = 0.001, and then go to the Table tab of one of the channels, you will see that the data actually comes in about every 4 milliseconds. This is because although DAQFactory is trying to read it at 1 millisecond intervals, the LabJack is taking about 4 milliseconds to actually perform the command.

---
language: "en"
---
# 11.5 - Unsupported Functions (Applies to UD-Series)

The LJ_ioSET_STREAM_CALLBACK, LJ_ioSET_EVENT_CALLBACK and any other LabJack function that requires a function pointer are not supported. These particular two callback's are handled internally by DAQFactory. The first allows DAQFactory to process streaming data, while the second handles connect and disconnect messages from the driver.

Also, you should not change the LJ_chSTREAM_WAIT_MODE, as all waiting is handled internally. If you change this, you will most likely cause streaming to stop functioning.

---
language: "en"
---
# 11 - Advanced (Applies to UD-Series)

**Subsections**

* [11.1 - Opening A LabJack Manually](https://support.labjack.com/docs/11-1-opening-a-labjack-manually-applies-to-ud-seri.md)
* [11.2 - Raw In/Out and Other Functions That Require Array Pointers](https://support.labjack.com/docs/11-2-raw-in-out-and-other-functions-that-require-a.md)
* [11.3 - SPI Communications](https://support.labjack.com/docs/11-3-spi-communications-applies-to-ud-series.md)
* [11.4 - Utilizing Multicore Processors](https://support.labjack.com/docs/11-4-utilizing-multicore-processors-applies-to-ud-.md)
* [11.5 - Unsupported Functions](https://support.labjack.com/docs/11-5-unsupported-functions-applies-to-ud-series.md)

---
language: "en"
---
# 12.0 200uA and 10uA (T7 Only)

The T7 has 2 fixed current source terminals useful for measuring resistance (thermistors, RTDs, resistors). The 10UA terminal provides approximately 10 µA and the 200UA terminal provides approximately 200 µA, but the actual values should be read from the calibration constants, or better yet measured in real-time using a fixed shunt resistor.  
![t7_200ua-and-10ua.JPG](https://support.labjack.com/__attachments/a_feeae5cda5519569115f0e70cf7faefafbe2cf39f212ee8ec18752164c4d2fd3/t7_200ua-and-10ua.JPG?cb=a4ea4cc41edfe0702fccb7f7917ec9ad)

Using the equation V=IR, with a known current and voltage, it is possible to calculate the resistance of the item in question. Figure 12-1 shows a simple setup measuring 1 resistor.

The factory value of each current source is noted during calibration and stored with the calibration constants on the device. These can be viewed using the [Device Info tab](https://support.labjack.com/docs/device-information.md) in Kipling, or read programmatically. Note that these are fixed constants stored during calibration, not some sort of real-time readings.

To read the constants, read from the following registers:

**Example:**

To read the factory value of the 200uA current source, perform a read of Modbus address 1902, and the result would be in the form of a floating point number, e.g. 0.000197456 amps.

## Examples Of Measuring Resistance

Multiple resistances can be measured by putting them in series and measuring the voltage across each. Some applications might need to use differential inputs to measure the voltage across each resistor, but for many applications it works just as well to measure the single-ended voltage at the top of each resistor and subtract in software.  

![currentsource1.jpg](https://support.labjack.com/__attachments/a_bea9c0053885e61107fb293f102baf29d0d6356de2a4961dfb0d3f1c2adffe1b/currentsource1.jpg?cb=62afeaadec849dd1d4ffff71f3e0f13e)
**Figure 12-1**  

![currentsource2.jpg](https://support.labjack.com/__attachments/a_b77ffb9a7c90153b719b0bda46d71ab345c4808673e5ed764efddad90b5b59f3/currentsource2.jpg?cb=9822b209a9dd0ab6156363f540d329e2)
**Figure 12-2**

**Figure 12-1** shows a simple setup measuring 1 resistor. If R1=3k, the voltage at AIN0 will be 0.6 volts.

**Figure 12-2** shows a setup to measure 3 resistors using single-ended analog inputs. If R1=R2=R3=3k, the voltages at AIN0/AIN1/AIN2 will be 1.8/1.2/0.6 volts. That means AIN0 and AIN1 would be measured with the ±10 volt range, while AIN2 could be measured with the ±1 volt range. This points out a potential advantage to differential measurements, as the differential voltage across R1 and R2 could be measured with the ±1 volt range, providing better resolution.  

![currentsource3.jpg](https://support.labjack.com/__attachments/a_9938e55cfd1e6dbd05e0d09fc318fd6f914ceb1004328b5814b4bc367bd272ab/currentsource3.jpg?cb=52f6af4c74be62c5a02d640f5a840d4a)
**Figure 12-3**  

![currentsource4.jpg](https://support.labjack.com/__attachments/a_c18e438a41d4590624e79b5d8b40c74d645b8dba61cc3049a7f886ac58c31ebb/currentsource4.jpg?cb=3a247a82c1f4fb5b8a7e44a066222932)
**Figure 12-4**

**Figure 12-3** shows a setup to measure 2 resistors using differential analog inputs. AIN3 is wasted in this case, as it is connected to ground, so a differential measurement of AIN2-AIN3 is the same as a single-ended measurement of AIN2. That leads to **Figure 12-4**, which shows R1 and R2 measured differentially and R3 measured single-ended.

## Remarks

**Maximum load resistance:**The current sources can drive about 3 volts max, thus limiting the maximum load resistance to about 300 kΩ (10UA) and 15 kΩ (200UA). Keep in mind that high source resistance could cause settling issues for analog inputs.

**Using a fixed resistor to calculate actual current:**For some applications the accuracy and temperature coefficient of the current sources is sufficient, but for improvement a fixed resistor can be used as one of the resistors in the figures above. The Y1453-100 and Y1453-1.0K from Digi-Key have excellent accuracy and very low tempco. By measuring the voltage across one of these you can calculate the actual current at any time.

**Handling load changes resulting in noise:**The current sources are not particularly fast in reacting to load changes. This can show up as noise when rapidly sampling multiple channels using the same current source. Improve behavior by adding a 1 µF ceramic capacitor from the current source to GND and/or increasing settling time.

**Temperature coefficients:**Figures 12-5 and 12-6 show the typical current source output variation over temperature. Both sources typically have low temperature coefficients at or near 25C. Beyond 25C, the temperature coefficient variation may need to be accounted for, depending on application requirements.  
![https://files.labjack.com/website/Images/U6_T7_CurrentSource_TempCo.png](https://files.labjack.com/website/Images/U6_T7_CurrentSource_TempCo.png)
**Figure 12-5.** Typical temperature coefficient values over operating temperature range  
![https://files.labjack.com/website/Images/U6_T7_CurrentSource_Deviation.png](https://files.labjack.com/website/Images/U6_T7_CurrentSource_Deviation.png)
**Figure 12-6.** Typical current source deviation from 25C output over operating temperature range

## Examples

PT100 or PT1000 RTD - AIN_EF  
The **AIN_EF (Analog Input Extended Features)** includes a dedicated RTD function that automates temperature calculations. The function requires that the RTD specifications and connection type be configured. Then an application can simply read the final temperature. The T-Series device handles all measurement and conversion details internally. For more details and detailed examples see [14.1.3 RTD](https://support.labjack.com/docs/14-1-3-rtd-t-series-datasheet).
PT100 or PT1000 RTD - Manual Calculations  
Assume that R1 in Figure 12-1 is a PT100 RTD. A PT100 RTD is 100 ohms at 0 degC. The response of an RTD is nonlinear, but the linear slope 0.384 ohms/degC works well from about -40 to +150 degC. That leads to the following expression:

`R = (0.384 * DegC) + 100`

...which can be rearranged to:

`DegC = (2.604 * R) - 260.4`

We are determining R by measuring the voltage that results from a known current passed through R, that is R = V/I, so we can say:

`DegC = (2.604 * V/I) - 260.4`

This tells us that the slope is 2.604/I and the offset is -260.4. To determine I, you can just use 0.0002 amps, or use the factory calibration value read from CURRENT_SOURCE_200UA_CAL_VALUE, or use a precision fixed resistor as mentioned above to measure I in real time. Assume we read the factory calibration value as 0.000200 amps, and thus use a constant slope of 2.604/0.0002 = 13020. We can now use the [AIN_EF Offset and Slope feature](https://support.labjack.com/docs/14-1-2-offset-and-slope-t-series-datasheet.md) to apply this slope and offset:

`AIN0_EF_INDEX = 1 // feature index for Offset and Slope`

`AIN0_EF_CONFIG_D = 13020.0 // slope`

`AIN0_EF_CONFIG_E = -260.4 // offset`

Now reads of AIN0_EF_READ_A will return `(13020.0 * volts) - 260.4`.

Note that you can come up with your own slope and offset for your temperature region of interest. For example, we made this [Spreadsheet](https://files.labjack.com/website/Spreadsheets/RTD%20-%20Linear%20Appoximation%20Error%20Calculation.xls) and decided that Slope=2.720 (degC/ohm) and Offset=-277.5 works best for the region of 100 to 300 degC.

Note that a PT1000 simply has 10x the response of a PT100 (\~3.84 ohms/degC). The offset still works out to -260.4, but the slope is 0.260.

---
language: "en"
---
# 12/24 VDC to USB Power Adapter Datasheet (Discontinued)

**Production Status: NLA (no longer available). The 12/24 VDC to USB Power Adapter has been replaced by the** [**DC-DC Power Adapter**](https://labjack.com/products/dc-dc-power-adapter)**.**

This IPS converter has has discontinued in favor of the more robust version linked above.

This IPS-DT1224S51.5 power converter from IPS was an accessory for LabJack applications where USB 5V DC power was not readily available. It was useful for using a 12 or 24 VDC source to power an Ethernet connected [T-Series LabJack](https://labjack.com/collections/t-series-devices).

Features:

* 5V output via USB Type B male connector to power a LabJack T4, T7, T7-Pro and T8

* Ethernet connection required for data/communication with LabJack device

* 8-35V input range for industrial, automotive and commercial applications

* 3-feet/1-meter input pigtails and output cable

* Output rated for 1.5 amps/ 7.5 watts

* Dimensions 46x27x14 MM

* Working Temp -40°c \~ +80°c

* Water-resistant IP65 rating

![1224-vdc-to-usb-power-adapter-816871.jpg](https://support.labjack.com/__attachments/a_a4108fa6336b7ff17abf44f9880ec551f3ff666e9f828d4ce3d7e265380644cf/1224-vdc-to-usb-power-adapter-816871.jpg?cb=eb43bcd19f11446cc183ab8f0f761d0a) Figure 1: 12/24 VDC to USB Power Adapter

---
language: "en"
---
# 13.0 Digital I/O \[T-Series Datasheet\]

## Overview

All LabJack T-series devices come with **Digital Input/Output (DIO)** lines. These versatile pins have many uses. This page covers the essential naming conventions, basic software commands, and the hardware details required for most applications.

For a list of the Digital IO available on each device see the tables here: [4.0 Hardware Overview](https://support.labjack.com/docs/4-0-hardware-overview-t-series-datasheet.md)

For more detail or advanced operation see these links:

* **For Hardware Specs:** If you need detailed electrical data, such as input impedance or voltage thresholds, see [A-2 Digital I/O](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md).

* **For Advanced Features:** If you are looking for information on updating the **DIO in groups** , configuring the **Pull-ups** , or setting the **boot-up defaults** visit the [Advanced DIO \& Configuration](https://support.labjack.com/docs/13-9-advanced-dio-control.md) page.

* **Serial Communication:** Interfacing with other digital logic circuits, sensors, and microcontrollers via [SPI](https://support.labjack.com/docs/13-4-spi-t-series-datasheet.md), [I2C](https://support.labjack.com/docs/13-3-i2c-t-series-datasheet.md), [Asynchronous Serial](https://support.labjack.com/docs/13-7-asynchronous-serial-t-series-datasheet.md), and [1-Wire](https://support.labjack.com/docs/13-6-1-wire-t-series-datasheet.md).

* **Measuring \& Generating Signals:** Output **PWM** with Phase Control and the ability to output a specific number of pulses. Measure **frequency** , dutycycle, and quadrature decoding. These are all part of Digital IO Extended Feature (DIO_EF) suite: [12.2 DIO Extended Features](https://support.labjack.com/docs/13-2-dio-extended-features-t-series-datasheet.md)

* **Sensirion SHT/** [SBUS](https://support.labjack.com/docs/13-5-sbus-t-series-datasheet.md) **:** Special support for Sensirion digital humidity and temperature sensors.

* **Stream:** For faster data rates, the states of the DIO can be read using [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md). And the DIO can updated using [stream_out](https://support.labjack.com/docs/3-2-3-stream-out-t-series-datasheet.md).

* **Controlling Hardware:** Activating [relays](https://support.labjack.com/docs/controlling-relays-and-loads-app-note.md) or solenoids.

## Operation

### Naming Conventions (FIO vs DIO)

Each digital I/O terminal has two names: a **Bank Name** and a **Simple Name**. Originally, bank names described specific hardware capabilities. As our devices have evolved, the features have expanded beyond the limit of the Bank terminology. To simplify future designs, new devices will be labeled using only "DIO#".

Whether your device is labeled FIO, EIO, CIO, or MIO, they all belong to the same **Digital I/O (DIO)** family. In software, most pins can be addressed by either label (e.g., "FIO4") or their universal index (e.g., "DIO4").
> **Note:** Some advanced functions, such as Digital IO Extended Features, require the use of the Simple Name (DIO#).

### Logic Levels

T-Series devices use **3.3V Logic**.

* When set to output, the IO will be driven to 0 or 3.3V.

* When set to input, if the voltage is below the low threshold (typically 0.9 V) the IO will report 0. If the voltage is above the high threshold (typically 2.1 V) the IO will report 1. See the specifications for the actual thresholds for each device.

**5V Tolerance:** All T-Series DIO are **5V Tolerant.** You can safely input a 5V signal without damaging the device.

If your application requires interfacing with larger voltages, like **24V industrial signals** or **5V logic chips** that require a full 5V swing, see [Interfacing with Voltages Above 3.3V](https://support.labjack.com/docs/13-8-dio-hardware-characteristics.md#Interfacing-with-Voltages-Above-3.3V)

## Read and Writing

Each IO line can be configured to be input or output. When set to output they can be set to drive to logic high or logic low. T-Series devices simplify the use of DIO by removing the need for an explicit direction command. Instead, the device will **automatically set the direction** according to these rules:

* When a register which accesses one DIO (eg: FIO4, DIO7, etc.) is written to, that line will be set to output.

* When a register which accesses one DIO is read, that line will be set to input.

### Writing to a Single DIO Line

To set the output state of a digital IO line, simple write 0 or 1 to the corresponding register.

### Reading from a Single DIO Line

To read the state of a digital IO line, read from the corresponding register.

### Read from an output

When using a register which access one DIO which is set to output, the line will be set to input and the state will be read very quickly ( 1 µs). This is often too fast for the actual state of the line to change. To ensure an accurate reading, the line should be reread a few milliseconds after the direction has been changed.

## DIO Registers

## Examples

Set FIO2/DIO2 to Output High  
To drive the line high (3.3V), write a value of **1** to the **FIO2** or **DIO2** register:

    // Example using the C# Wrapper (Only one of the two following lines are needed)
    LJM.eWriteName(handle, "FIO2", 1); 
    LJM.eWriteName(handle, "DIO2", 1);

**Result:** The specified line is automatically configured as an **output** and driven to a **high state (3.3V)**.
Read the State of a FIO3/DIO3  
To read the state of the **FIO3** or **DIO3** register, use the `eReadName` or `eReadName` function.

    // Example using the C# Wrapper. (Only one of the two following lines are needed)
    LJM.eReadName(handle, "FIO3", ref io_state);
    LJM.eReadName(handle, "DIO3", ref io_state);

**Important Considerations:**

* **Automatic Direction Switching:** Calling a read function on these lines will automatically set the line to **input**.

* **Voltage Settling:** Because the switch to input happens almost instantaneously, an initial read may reflect the line's previous "output" voltage rather than its new state (which may be driven by an external circuit or internal pull-ups).

* **Best Practice:** When switching a line from output to input, take a **second reading** a few milliseconds after the first. This ensures the voltage has fully settled and the value is accurate.

## Troubleshooting

DIO Changed State Automatically  
As described in [Electrical Overview](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md) above, digital I/O on T-series devices are tri-state and thus have 3 possible states: input, output-high, or output-low. The DIO stay in their current state until told to go to some different state. There are various ways they could be told to go to a different state:

* Some software sends a command telling a DIO to go to a different state.

* Your [Lua script](https://support.labjack.com/docs/25-0-lua-scripting-t-series-datasheet.md) running on the device tells a DIO to go to a different state.

* The [watchdog](https://support.labjack.com/docs/23-0-watchdog-t-series-datasheet.md) tells DIO to go to a different state.

* The T7 reboots causing the DIO to go to the saved [power-up condition](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md).

Unexpected Voltage On IO Terminals  
If a DIO terminal is at about 3.3 volts, and you are not sure if it is set to input or output-high, a couple ways to tell are:

Look for a slight change on a terminal with nothing connected except a DMM. For example, a DMM measurement of an input might show 3.30V whereas that same terminal as output-high reads 3.31V.

Add a load resistor. If you add a 100k from FIO7 to GND, the terminal should measure about 1.6V for input and 3.3V for output-high.

See [Appendix A-2](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md) for more details.

---
language: "en"
---
# 13.1 Flexible I/O (T4 Only) \[T-Series Datasheet\]

## Flexible I/O Overview - T4 Only

**Basics:** Flexible I/O are ports, channels, or lines on a LabJack device that may be configured as analog inputs, as digital inputs, or as digital outputs.

**Device Control Basics:**

* All T-series device features are controlled by reading and writing Modbus TCP registers via Modbus TCP (either directly or through our [LJM library](https://support.labjack.com/docs/ljm-library-overview.md)).

* We have register descriptions throughout documentation detailing relevant register names, starting addresses, types, and access permissions (read/write).

* See [Section 3.0 Communication](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) for other detailed communication information.

**Digital I/O:** [13.0 Digital I/O](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md)

**Analog I/O:** [14.0 Analog Inputs](https://support.labjack.com/docs/14-0-analog-inputs-t-series-datasheet.md)

## Available T4 Flexible I/O Channels

As Figure 13.1-1 shows below, the LabJack T4 has 8 flexible I/O lines:

* Four screw terminals labeled FIO4 through FIO7 (also named as DIO4-DIO7 and as AIN4-AIN7)

* Four [DB15](https://support.labjack.com/docs/17-0-db15-t-series-datasheet.md) pins labeled EIO0 through EIO3 (also named as DIO8-DIO11 and as AIN8-AIN11)

![b94b1f4d-0dd7-c7f6-f167-a2597582ad92t4_flex_io_locations_lg.jpg](https://support.labjack.com/__attachments/a_3bd0d96a919fcb77cd2d4686c92c18692d196a2e832b8155cfb25a1cc018964f/b94b1f4d-0dd7-c7f6-f167-a2597582ad92t4_flex_io_locations_lg.jpg?cb=d7728a5a38c5c077b849806b24ce01e7)

The flexible I/O lines are readable/writable as digital I/O using the register names DIO4 through DIO11:

The flexible I/O lines are readable as analog inputs using the register names AIN4 through AIN11:

For examples on how to use these registers, see [13.0 Digital I/O](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md) and [14.0 Analog Inputs](https://support.labjack.com/docs/14-0-analog-inputs-t-series-datasheet.md).

## Flexible I/O Auto-Configuration

Flexible I/O lines will be auto-configured in some situations. Flexible I/O can also be manually configured, as described below.

### Digital Inputs - Always Auto-Configured

Reading DIO4-DIO11 always auto-configures the given line to be a digital input (before returning the digital state a 1 or 0).

### Digital Outputs - Not Always Auto-Configured

Writing DIO4-DIO11 only auto-configures the given line to be a digital output if the line is currently a digital input. If the channel is currently configured as an analog input, the channel will remain configured as an analog input and the write command will be ignored.

To force a flexible I/O line to be a digital output, you can read it as digital, then write to it as digital. Be aware that an analog sensor may be damaged by driving voltage into its output.

### Analog Inputs --- Always Auto-Configured

Reading from AIN4-AIN11 always auto-configures a channel to be an analog input.

## Flexible I/O Manual and Bulk Configuration

The following registers can configure multiple flexible I/O lines at once:

To configure multiple flexible I/O lines, set the relevant bits of DIO_INHIBIT, DIO_ANALOG_ENABLE, DIO_DIRECTION, and DIO_STATE---where the relevant bits are the same as the DIO channel numbers. Examples:

* To configure DIO4 (screw terminal FIO4), set bit 4 of DIO_INHIBIT, DIO_ANALOG_ENABLE, etc.

* To configure DIO5 (screw terminal FIO5), set bit 5 of DIO_INHIBIT, DIO_ANALOG_ENABLE, etc.

* To configure DIO8 (DB15 pin EIO0), set bit 8 of DIO_INHIBIT, DIO_ANALOG_ENABLE, etc.

**To configure digital input(s)**:

* Set the relevant bit(s) of DIO_INHIBIT to 0

* Set the relevant bit(s) of DIO_ANALOG_ENABLE to 0

* Set the relevant bit(s) of DIO_DIRECTION to 0

* Read the relevant DIO register(s) or read DIO_STATE

For example, to configure DIO4 (screw terminal FIO4) as a digital input:

* Set bit 4 of DIO_INHIBIT to 0

* Set bit 4 of DIO_ANALOG_ENABLE to 0

* Set bit 4 of DIO_DIRECTION to 0

* Read DIO4 or read bit 4 of DIO_STATE

**To configure digital output(s)**:

* Set the relevant bit(s) of DIO_INHIBIT to 0

* Set the relevant bit(s) of DIO_ANALOG_ENABLE to 0

* Set the relevant bit(s) of DIO_DIRECTION to 1

* Write the relevant DIO register(s) or write to DIO_STATE

For example, to configure DIO4 (screw terminal FIO4) as a digital output:

* Set bit 4 of DIO_INHIBIT to 0

* Set bit 4 of DIO_ANALOG_ENABLE to 0

* Set bit 4 of DIO_DIRECTION to 0

* Write to DIO4 or write bit 4 of DIO_STATE

**To configure analog input(s)**:

* Set the relevant bit(s) of DIO_INHIBIT to 0

* Set the relevant bit(s) of DIO_ANALOG_ENABLE to 1

* Read the relevant AIN register(s)

For example, to configure AIN4 (screw terminal FIO4) as a analog input:

* Set bit 4 of DIO_INHIBIT to 0

* Set bit 4 of DIO_ANALOG_ENABLE to 1

* Read AIN4

**Tips for Constructing Bitmasks**

The DIO_INHIBIT value for allowing a write command to only affect DIO4 and DIO5 is as follows:

`0x7FFFFF - (1<<4)|(1<<5)` which equals `0b11111111111111111001111`, `0x7FFFCF`, or `8388559`.

After writing `0x7FFFCF `to the DIO_INHIBIT register, the DIO_ANALOG_ENABLE value for configuring DIO4 and DIO5 as analog inputs is as follows:

`(1<<4)|(1<<5)` which equals `0b110000 `,` 0x30`, or `48`.

## Flexible I/O Pull-Up

The T4 can disable the pull-ups on some of its IO lines. An IO line with its pull-up disabled will be floating, any readings will not be meaningful until an external signal is connected. Pull-ups can be disabled on FIO4(DIO4) through EIO3 (DIO11).

---
language: "en"
---
# 13.2.1 EF Clock Source \[T-Series Datasheet\]

## Overview

The DIO Extended Features (DIO-EF) allow for advanced digital waveform measurement and generation. These features rely on clock sources for timing. The clock sources produce the reference frequencies which are used to generate output waveforms and measure input waveforms. They control output frequency, PWM resolution, maximum measurable period, and measurement resolution.

## Clock Sources and Availability

There are three DIO-EF clock sources available, each with specific characteristics and potential conflicts due to shared hardware resources.

### Clock Source Specifications

Clock source have different bit sizes. The bit size will limit the maximum value that can be used for RollValue:

* **CLOCK0**: 32-bit

* **CLOCK1**: 16-bit

* **CLOCK2**: 16-bit

### Mutual Exclusions

Due to shared hardware resources, certain DIO-EF features and clock sources cannot be used simultaneously. The following table outlines these mutual exclusions:

**T4/T7:**

* **CLOCK0** : Mutual Exclusions: **CLOCK1** , **CLOCK2** , High-Speed Counter on **CIO0** , and High-Speed Counter on **CIO1**

* **CLOCK1** : 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on **CIO0**

* **CLOCK2:** 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on **CIO1**

**T8:**

* **CLOCK0:** Mutual Exclusions: **CLOCK1** , **CLOCK2** , High-Speed Counter on **EIO6** , High-Speed Counter on **EIO7**

* **CLOCK1** : Mutual Exclusions: CLOCK0, High-Speed Counter on **EIO6**

* **CLOCK2** : Mutual Exclusions: CLOCK0, High-Speed Counter on **EIO7**

## Clock Source Configuration

Each clock source has two key characteristics which need to be configured: Frequency and TickRate. The Frequency of the clock source will be the frequency of output modes and the corresponding period will be the maximum measurable period of input modes. The TickRate sets the smallest step for duty cycle adjustment, and the resolution of measurements. The Frequency and TickRate are configured by specifying the Divisor and RollValue according to the following formulas:

`Frequency = CoreFrequency /( Divisor * RollValue )`

`TickRate = CoreFrequency / Divisor`

`Period = 1 / Frequency`

`Resolution = 1 / TickRate`

### CoreFrequency

The core frequency is device specific, refer to the below list for the proper value:

* **T4**: 80 MHz

* **T7**: 80 MHz

* **T8**: 100 MHz

### Divisor

The valid values for DIO_EF_CLOCK#_DIVISOR are 1, 2, 4, 8, 16, 32, 64, or 256, and a value of 0 (default) equates to a divisor of 1.

### RollValue

The roll value determines how high the clock will count before starting the count over, also known as a roll. The maximum value varies by which clock source is being used. See the below list for the max value for each clock:

* **Clock0**: 4294967295, where 0 = 4294967296

* **Clock1**: 65535, where 0 = 65536

* **Clock2**: 65535, where 0 = 65536

### Clock Source Considerations

This section provides guidelines for optimizing clock source selection and configuration for both input and output modes.

#### Input Modes

* **Period Measurement:** To accurately measure a signal's period, the clock source Period must exceed the maximum period of the signal being measured.

* **Resolution:** To achieve maximum measurement resolution, use the smallest possible clock source roll value that accommodates the required measurement period.

#### Output Modes

* **Frequency:** The frequency of output modes, such as Pulse Width Modulation (PWM), is directly determined by the selected clock source frequency.

* **Resolution:** The resolution of output modes refers to the smallest adjustable increment of the output signal (e.g., duty cycle in PWM).

### Configuration Registers

### Tips and Tricks

A clock source can be enabled after DIO#_EF_INDEX has been configured. This allows several DIO-EFs to be started at the same time.

## Read

Reading the clock can be useful for generating timestamps. To read the clock, read DIO_EF_CLOCK0_COUNT:

## Update

Both the ROLL_VALUE and the DIVISOR can be written while a clock source is running. As long as the clock source's period is greater than 50 µs, the clock will seamlessly switch to the new settings.

## Reset

At this time there are no reset operations available for the DIO-EF clock sources.

## Examples

Configure CLOCK0 so that a PWM output (index=0) will have a frequency of 10 Hz. ( T4 / T7)  
`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 8 # 80 MHz / 8 = 10 MHz`

`DIO_EF_CLOCK0_ROLL_VALUE = 1000000`

`DIO_EF_CLOCK0_ENABLE = 1`

A frequency input measurement (index=3/4) will be able to count from 0-999999 with each count equal to 0.1 microseconds, and thus a max period of just under 0.1 seconds.
Configure CLOCK0 so that a PWM output (index=0) will have a frequency of 10 Hz. ( T8)  
`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 16 # 100 MHz / 16 = 6.25 MHz`

`DIO_EF_CLOCK0_ROLL_VALUE = 625000`

`DIO_EF_CLOCK0_ENABLE = 1`

A frequency input measurement (index=3/4) will be able to count from 0-624999 with each count equal to 0.16 microseconds, and thus a max period of just under 0.1 seconds.

---
language: "en"
---
# 13.2.10 Interrupt Counter with Debounce \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5, DIO6, DIO7, DIO8, DIO9** (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO6, DIO7** (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: **No**

Index: **9**

Streamable: **No.**

Interrupt Counter with Debounce will increment its count by 1 when it receives a rising edge, a falling edge, or any edge (2x counting). After seeing an applicable edge, any further edges will be ignored during the debounce time.

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. See the discussion of edge rate limits at the bottom of this page.

## Debounce Modes (DIO#_EF_CONFIG_B)

The exact behavior of the counting/debouncing is controlled by an index value written to DIO#_EF_CONFIG_B.

* 0: Count falling, debounce all, self-restarting timeout.

* 1: Count rising, debounce all, self-restarting timeout.

* 2: Count \& debounce all, self-restarting timeout.

* 3: Count \& debounce falling, fixed timeout.

* 4: Count \& debounce rising, fixed timeout.

* 5: Timeout starts on falling edge. During timeout, a rising edge cancels and a falling edge restarts the timeout. After timeout any edge causes a count.

* 6: Timeout starts on rising edge. During timeout, a falling edge cancels and a rising edge restarts the timeout. After timeout any edge causes a count.

Self-restarting timeout means that during timeout any edge will restart the timeout with the value specified with DIO#_EF_CONFIG_A.

Mode 0 is commonly used with a normally-open push-button switch that is actuated by a person. We only want to count the push (falling edge), but expect bounce on the push \& release (falling \& rising edges) so need to debounce both.

Mode 4 might be used with some sort of device that outputs a fixed length positive pulse. For example, say a device provides a 1000 µs pulse, and there is always at least 5000 µs between pulses. Set the debounce timeout to 2000 µs so that the timeout period safely covers the entire pulse, but the timeout will for sure be done before another pulse can occur.

Modes 5 \& 6 implement a requirement that the state of the line must remain low or high for some amount of time. For example, if you use mode 5 with a push-button switch and set DIO#_EF_CONFIG_A = 50000, that means that someone must push the switch and hold it down solidly for at least 50ms, and then the count will occur when they release the switch. An advantage to these modes is that they will ignore brief transient signals.

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 9

DIO#_EF_CLOCK_SOURCE: Not used.

DIO#_EF_CONFIG_A: Debounce timeout in microseconds (µs, 0-1000000).

DIO#_EF_CONFIG_B: Debounce mode index.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_B: Not used.

## Update

No update operations can be performed on Interrupt Counter with Debounce.

## Read

Results are read from the following register.

DIO#_EF_READ_A: Returns the current Count

## Reset

DIO#_EF_READ_A_AND_RESET: Reads the current count then clears the counter. Note that there is a brief period of time between reading and clearing during which edges can be missed. During normal operation this time period is 10-30 µs. If missed edges at this point can not be tolerated then reset should not be used.

## Example

Enable a debounce counter on DIO0 (use DIO4 on the T4):

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 9`

`DIO0_EF_CONFIG_A = 20000 // 20 ms debounce time`

`DIO0_EF_CONFIG_B = 0 // count falling, debounce all, self-restarting timeout`

`DIO0_EF_ENABLE = 1`

Results can be read from the READ registers defined above.

## Edge Rate Limits

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based. To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second. If stream mode is active, the limit is reduced to 20k edges/second. Excessive processor loading (e.g. a busy Lua script) can also reduce these limits. Note that interrupt features must process all edges, rising \& falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete. When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel. Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts). When an ISR completes, it clears the IF for that channel. So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A \& B have an edge occur at the same time and an ISR starts to process the edge on channel A. If channel A has another edge during the first 14 μs, that edge will be lost. If channel B has another edge during the first 14 μs, the initial edge will be lost. If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

---
language: "en"
---
# 13.2.11 Quadrature In \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5, DIO6, DIO7, DIO8, DIO9** (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO6, DIO7** (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: **No**

Index: **10**

Streamable: **Yes---integer READ registers only.**

Quadrature input uses two DIOs to track a quadrature signal. Quadrature is a directional count often used in various types of **rotary encoders** when you need to keep track of absolute position with forward \& reverse movement. If you have movement in only one direction, or another way to know direction, you can simply use a normal counter with one phase of the encoder output.

T-series devices uses 4x quadrature decoding, meaning that every edge observed (rising \& falling on both phases) will increment or decrement the count.

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. See the discussion of edge rate limits at the bottom of this page.

Quadrature is prone to error if the edge rate is exceeded. This is particularly likely during direction change where the time between edges can be very small. Errors can occur when two edges come in too quickly for the device to process, which can result in missed counts or missed change in direction. These errors will be recorded and the quantity encountered can be read. If three edges come in too quickly an undetectable error can occur.

Some quadrature encoders also include a third output channel, called a zero (Z-phase) or index or reference signal, which supplies a single pulse per revolution. This single pulse is used for absolute determination of position. T-series devices support resets according to this reference signal. Z-phase will reset the count when a high state is detected on the specified DIO line at the same time any edge occurs on A or B phases. If the reference pulse is wider than A/B pulses, consider using the [Conditional Reset](https://support.labjack.com/docs/13-2-13-conditional-reset-t-series-datasheet.md) feature instead of this Z-phase support. If the reference pulse is only high in between A/B edges, consider some sort of RC circuit to elongate it or consider using the [Conditional Reset](https://support.labjack.com/docs/13-2-13-conditional-reset-t-series-datasheet.md) feature. If set to one-shot mode, Z-phase will clear the count only once and must be "re-armed" by disabling/re-enabling the feature or a read from DIO#_EF_READ_A_AND_RESET.

## Configure

Two DIO must be configured for Quadrature In. The two lines must be an adjacent even/odd pair:

T4: DIO4/5, DIO6/7, and DIO8/9 are valid pairs.

T7: DIO0/1, DIO2/3, and DIO6/7 are valid pairs.

The even IO line will be phase A and the odd will be phase B.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 10

DIO#_EF_CLOCK_SOURCE: Not used.

DIO#_EF_CONFIG_A: Z-phase control: 0 = Z-phase off, 1 = Z-phase on, 3 = Z-phase on in one shot mode.

DIO#_EF_CONFIG_B: Z-phase DIO number.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

## Update

No update operations can be performed with Quadrature In.

## Read

The quadrature count and error count are available from the even channel. The odd channel will return zeros.

Results are read from the following registers.

DIO#_EF_READ_A - Returns the current count as a signed 2's complement value.

DIO#_EF_READ_B -- Returns the number of detected errors.

DIO#_EF_READ_A_F - Returns the count in a single precision float (float32).

Only reading DIO#_EF_READ_A or DIO#_EF_READ_A_F triggers a new measurement.

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits .  
Helpful Hints when streaming DIO-EF Quadrature

The Quadrature DIO#_EF_READ_A value is a signed 2's compliment integer, special considerations need to be made to stream this value. See notes below for more info.

* Stream is limited to 16-bit values. Streaming the READ_A value will only return the lower 16 bits (LSW). You also need to use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits (MSW). See the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md#32-bit) about how to reconstruct the 2 16-bit values into a 32-bit value.

* For a simple way to convert a negative value after reconstructing the unsigned 32-bit see the pseudocode below:

      if u32_value >= 2^(31)
        i32_value = u32_value - 2^32;
      else
        i32_value = int32(u32_value);
      end        

You may see the LJM warning LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (Errorcode 1320) when streaming Quadrature READ_A.

This can occur at negative counts when the MSW = 0xFFFF.

See the [LJM Stream Configs section](https://support.labjack.com/docs/ljm-stream-configs.md#How-to-Eliminate-LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED-(Errorcode-1320)) to eliminate the auto-recovery warnings.

## Reset

DIO#_EF_READ_A_AND_RESET -- Performs the same operation as DIO#_EF_READ_A, then sets the count to zero.

DIO#_EF_READ_A_F_AND_RESET -- Performs the same operation as DIO#_EF_READ_A_F, then sets the count to zero.

## Example

See our [Kipling quadrature input guide](https://support.labjack.com/docs/configuring-reading-a-quadrature-signal.md).

Configure DIO6 and DIO7 as quadrature inputs:

`DIO6_EF_ENABLE = 0 //Make sure DIO-EF is disabled on DIO6`

`DIO7_EF_ENABLE = 0 //Make sure DIO-EF is disabled on DIO7`

`DIO6_EF_INDEX = 10 //Set feature index for DIO6 to quadrature.`

`DIO7_EF_INDEX = 10 //Set feature index for DIO7 to quadrature.`

`DIO6_EF_ENABLE = 1 //Enable quadrature DIO-EF on DIO6, for A phase.`

`DIO7_EF_ENABLE = 1 //Enable quadrature DIO-EF on DIO7, for B phase.`

Edges on the two lines will now be decoded and the count will be incremented or decremented according to the edge sequence.

The current count can be read from DIO6_EF_READ_A or DIO6_EF_READ_A_AND_RESET.

To enable z-phase connected to DIO5 you would do:

`DIO6_EF_CONFIG_A=1`

`DIO6_EF_CONFIG_B=5`

`DIO7_EF_CONFIG_A=1`

`DIO7_EF_CONFIG_B=5 `

## Testing

On some LabJack devices you can physically tap a GND wire into the two DIO channels to cause some counts, but that does not work on T-series devices. Testing needs to be done with a proper quadrature signal.

If testing with an actual encoder, start with DIO-EF enabled and simply watch (e.g. in Kipling) the digital inputs as you slowly turn the encoder to see if the inputs change between high and low. That confirms a valid electrical connection.

You can test using 2 digital outputs to create a quadrature sequence. For example, configure quadrature on DIO6/7 as shown above, and connect DIO0 to DIO6 and DIO1 to DIO7. This can be done with the Register Matrix in Kipling.

`DIO0 = 1 //Initialize DIO0 to output-high.`

`DIO1 = 1 //Initialize DIO1 to output-high.`

`DIO6_EF_ENABLE = 0 //Make sure DIO-EF is disabled on DIO6`

`DIO7_EF_ENABLE = 0 //Make sure DIO-EF is disabled on DIO7`

`DIO6_EF_INDEX = 10 //Set feature index for DIO6 to quadrature.`

`DIO7_EF_INDEX = 10 //Set feature index for DIO7 to quadrature.`

`DIO6_EF_ENABLE = 1 //Enable quadrature DIO-EF on DIO6, for A phase.`

`DIO7_EF_ENABLE = 1 //Enable quadrature DIO-EF on DIO7, for B phase.`

Now we can simulate a quadrature signal by toggling DIO0 and DIO1---aka FIO0 and FIO1---in the proper sequence. We will use the FIO_STATE register (address=2500) which operates on all 8 FIO bits at once, but we will set the inhibit bits for FIO2-FIO7 (bits 10-15) so they are not affected. To set bits 10-15 we can simply add 64512 to the desired FIO0/1 state value:

`Write FIO_STATE = 3 + 64512, then should read DIO6_EF_READ_A = 0`

`Write FIO_STATE = 1 + 64512, then should read DIO6_EF_READ_A = 1`

`Write FIO_STATE = 0 + 64512, then should read DIO6_EF_READ_A = 0`

`Write FIO_STATE = 2 + 64512, then should read DIO6_EF_READ_A = -1`

`Write FIO_STATE = 3 + 64512, then should read DIO6_EF_READ_A = -2`

`Write FIO_STATE = 2 + 64512, then should read DIO6_EF_READ_A = -1`

`Write FIO_STATE = 0 + 64512, then should read DIO6_EF_READ_A = 0`

`Write FIO_STATE = 1 + 64512, then should read DIO6_EF_READ_A = 1`

`Write FIO_STATE = 3 + 64512, then should read DIO6_EF_READ_A = 2`

`Write FIO_STATE = 2 + 64512, then should read DIO6_EF_READ_A = 3`

`Write FIO_STATE = 0 + 64512, then should read DIO6_EF_READ_A = 4`

`Write FIO_STATE = 1 + 64512, then should read DIO6_EF_READ_A = 5`

`Write FIO_STATE = 3 + 64512, then should read DIO6_EF_READ_A = 6`

`Write FIO_STATE = 2 + 64512, then should read DIO6_EF_READ_A = 7`

## Quadrature Decoding or Simple Counting?

Quadrature decoding is only needed when you need to keep track of absolute position with changes in direction included.

If you want to track absolute position but the direction does not change, or for whatever reason you always know the direction of movement, then you can just count the pulses from one phase (A or B) using a simple counter. The [interrupt counters](https://support.labjack.com/docs/13-2-9-interrupt-counter-t-series-datasheet.md) available on 6 of the FIO0 lines have the same 70k edge rate limit discussed below, but they only do 1x counting and only use 1 timer. The [high-speed counters](https://support.labjack.com/docs/13-2-8-high-speed-counter-t-series-datasheet.md) on the 4 CIO lines can handle up to 5 MHz per counter.

If you are just trying to measure frequency, you can use a counter as described above and note the change in count over some time interval, or you can use a [DIO-EF](https://support.labjack.com/docs/13-2-dio-extended-features-t-series-datasheet.md) that measures the time of individual pulses. Either way, just one phase (A or B) is needed.

## Edge Rate Limits

Keep in mind that T-series devices do 4x quadrature counting. For example, a 100 pulses/revolution encoder connected to a pair of DIO will generate 400 edges/revolution.

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based. To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second. If stream mode is active, the limit is reduced to 20k edges/second. Excessive processor loading (e.g. a busy Lua script) can also reduce these limits. Note that interrupt features must process all edges, rising \& falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete. When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel. Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts). When an ISR completes, it clears the IF for that channel. So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A \& B have an edge occur at the same time and an ISR starts to process the edge on channel A. If channel A has another edge during the first 14 μs, that edge will be lost. If channel B has another edge during the first 14 μs, the initial edge will be lost. If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

For faster quadrature tracking, one option is to use a chip such as the [LS7366R-S](https://lsicsi.com/products/ls7366r-s-ls7366r-ts-ls7366r/) from US Digital and then use the SPI ability of the T-series device to talk to that chip. In fact, a Lua script can be used to handle the SPI communication with the chip and periodically put the current count in a user-ram register than can be easily read by any host application or Modbus client.

**Examples:**

See the [Rotary Encoder](https://support.labjack.com/docs/photoelectric-rotary-encoder-h38s100b.md) app-note for examples and more.

---
language: "en"
---
# 13.2.12 Interrupt Frequency In \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5, DIO6, DIO7, DIO8, DIO9** (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO6, DIO7** (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: **No. Uses core clock / 2.**

Index: **11**

Streamable: **Yes---integer READ registers only.**

Interrupt Frequency In will measure the frequency of a signal on the associated DIO line.

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. See the discussion of edge rate limits at the bottom of this page.

To measure the frequency, the T-series device will measure the duration of one or more periods. There are several option available to control the way the LabJack does this. The number of periods to be averaged, the edge direction to trigger on, and whether to measure continuously or in one-shot mode can all be specified.

The clock source for this feature is simply half the core frequency (See the [Clock Speed](https://support.labjack.com/docs/4-0-hardware-overview-t-series-datasheet.md) section for information about your device clock speed settings):

`ClockFrequency = CoreFrequency / 2`

`Period(s) = DIO#_EF_READ_A / ClockFrequency`

`Frequency (Hz) = ClockFrequency / DIO#_EF_READ_A`

The maximum measurable time is 107 s. The number of periods to be averaged multiplied by the maximum expected period must be less than 107 s or the result will overflow:

`107 > (NumToAverage * MaxPeriod)`

By default, Interrupt Frequency In operates in one-shot mode where it will measure the frequency once after being enabled and a new measurement only once after each read. The other option is continuous mode, where the frequency is constantly measured (every edge is processed) and READ registers return the most recent result. Running in continuous mode puts a greater load on the processor.

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 11

DIO#_EF_CLOCK_SOURCE: Not Used.

DIO#_EF_CONFIG_A: Default = 0. Bit 0: Edge select; 0 = falling, 1 = rising. Bit 1: 0 = one-shot, 1 = continuous.

DIO#_EF_CONFIG_B: Default = 0 which equates to 1. Number of periods to be measured and averaged.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

**One-Shot**

When one-shot mode is enabled, the DIO_EF will complete a measurement then go idle. No more measurements will be made until the DIO_EF has been read or reset.

**Continuous**

When continuous mode is enabled, the DIO_EF will repeatedly make measurements. If a new reading is completed before the old one has been read the old one will be discarded.

**Averaging**

When averaging is enabled, the DIO_EF will wait for the specified number of measurements to be completed, then the average of the measurements will be made available in the READ registers.

**CONFIG_A Value Map**

To configure the DIO_EF measurement mode, refer to the table below for the mapping between the bit field value and the corresponding integer value which should be written to DIO#_EF_CONFIG_A.  

|  **Measurement Mode**  | **Bit Field** | **Int Value** |
|------------------------|---------------|---------------|
| **One-Shot Falling**   | 0b00          | 0             |
| **One-Shot Rising**    | 0b01          | 1             |
| **Continuous Falling** | 0b10          | 2             |
| **Continuous Rising**  | 0b11          | 3             |

## Update

No update operations can be performed with Interrupt Frequency In.

## Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the average period per cycle in ticks (core clock ticks / 2).

DIO#_EF_READ_B: Returns the total core clock tick count (Core_Timer) at time of measurement.

DIO#_EF_READ_A_F: Returns the average period per cycle in seconds. Takes into account the number of periods to be averaged and the core clock speed.

DIO#_EF_READ_B_F: Returns the average frequency in Hz. Takes into account the number of periods to be averaged and the core clock speed.

Note that all "READ_B" registers are capture registers. All "READ_B" registers are only updated when any "READ_A" register is read. Thus it would be unusual to read any B registers without first reading at least one A register.

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Reset

DIO#_EF_READ_A_AND_RESET: Returns the same data as DIO#_EF_READ_A and then clears the result so that zero is returned by subsequent reads until another full period is measured (2 new edges).

DIO#_EF_READ_A_AND_RESET_F: Returns the same data as DIO#_EF_READ_A_F and then clears the result so that zero is returned by subsequent reads until another full period is measured (2 new edges).

## One-shot, Continuous, Read, Read and Reset

When you configure this feature you can choose one-shot or continuous mode, and when you read from this feature you can do so without or with reset. This leads to 4 different behaviors.

One common scenario is an application that should always display the most recent frequency measurement. You don't want the display to go to 0 if you are reading faster than the pulses are coming in, but rather want it to keep returning the last measurement it did get. This is typically accomplished with one-shot and read without reset, but continuous can also be used.

Another common scenario is where you are reading faster than pulses are coming in, you want 1 and only 1 read to return a measurement when available, and want extra reads to return 0. This is typically accomplished with continuous and read with reset.

One-shot, read without reset:

* When a measurement has been completed, the value(s) are stored and the DIO_EF will be paused.

* When the READ_A register is read, the stored value for READ_A will be returned.

* Reading again, before another measurement has been completed, will return the previous result.

* At most, every other period will be measured. The delay between completing a measurement and the read causes come portion of a period to be missed.

* Use this mode when you need to be able to continuously read the most recent measurement and when you want to reduce the LabJack's processor loading.

One-shot, read with reset:

* When a measurement has been completed, the value is stored, and the DIO_EF will be paused.

* When the READ_A register is read, the stored value for READ_A will be returned and then that stored value will be set to zero. After the read has been completed, a new measurement will be started.

* Reading from READ_A again before another measurement has been completed will return zero. READ_B will continue to return the most recent value.

* At most, every other period will be measured. The delay between completing a measurement and the read causes come portion of a period to be missed.

* Use this mode when you need to get a result once for each new measurement and zero otherwise. This mode is also useful for reducing the LabJack's processor loading.

Continuous, read without reset:

* Each time a measurement is completed, the value is stored. The previously stored value will be overwritten, even if it has not been read.

* When the READ_A register is read, the stored value for READ_A will be returned.

* Measures every period as long as the signal frequency and processor utilization allow.

* Use this mode when you need to measure every period, or you want the value from the most recent measurement.

Continuous, read with reset:

* Each time a measurement has been completed, the value is stored. The previously stored value will be overwritten, even if is has not been read.

* When the READ_A register is read, the stored value for READ_A will be returned and then that stored value will be set to zero.

* Read B, will always return the value from the most recent measurement.

* Measures every period as long as the signal frequency and processor utilization allow.

* Use this mode when you need to measure every period, and you only want a non-zero value when a new measurement has been completed.

## Example

To configure Interrupt Frequency In on DIO6 you can simply write to 2 registers:

`DIO6_EF_ENABLE = 0`

`DIO6_EF_INDEX = 11`

`DIO6_EF_ENABLE = 1`

Now you can read the period in seconds from a 4th register DIO6_EF_READ_A_F.

## Edge Rate Limits

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based. To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second. If stream mode is active, the limit is reduced to 20k edges/second. Excessive processor loading (e.g. a busy Lua script) can also reduce these limits. Note that interrupt features must process all edges, rising \& falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete. When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel. Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts). When an ISR completes, it clears the IF for that channel. So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A \& B have an edge occur at the same time and an ISR starts to process the edge on channel A. If channel A has another edge during the first 14 μs, that edge will be lost. If channel B has another edge during the first 14 μs, the initial edge will be lost. If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

---
language: "en"
---
# 13.2.13 Conditional Reset \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5, DIO6, DIO7, DIO8, DIO9** (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO6, DIO7** (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: **No**

Index: **12**

Streamable: **No**

DIO-EF Conditional Reset will reset a specified DIO-EF after a specified number of edges have been detected.

## Configure

To set up a DIO-EF Conditional Reset is simple. Just set the DIO number of the DIO-EF you would like to reset and then set the other options.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 12

DIO#_EF_CLOCK_SOURCE: Not used.

DIO#_EF_CONFIG_A: Reset Options bit field:

* bit 0: Edge select. 1 = rising, 0 = falling

* bit 1: Disable. 1 = disable the selected DIO_EF on reset. 0 = don't disable.

* bit 2: One-Shot. 1 = only reset once. 0 = reset every n edges.

DIO#_EF_CONFIG_B: Number of edges per reset.

DIO#_EF_CONFIG_C: IO number of DIO-EF to be reset.

DIO#_EF_CONFIG_D: Not used.

**Disable vs. One-Shot**

To disable a DIO_EF mode instead of resetting the count, set the DIO#_EF_CONFIG_A "Disable" bit to 1. This is similar behavior to a One-Shot reset, but instead of resetting the count only once, it disables the set DIO_EF mode on reset.

There is conflicting behavior between Disable and One-Shot so it is recommended to use either Disable or One-Shot (or neither), but not both. In the case where both Disable and One-Shot are used, Disable has a higher priority so the selected DIO_EF will be disabled instead of being reset.

**CONFIG_A Value Map**

To configure the DIO_EF reset options, refer to the table below for the mapping between the Reset Options bit field, and the corresponding integer value which should be written to DIO#_EF_CONFIG_A.  

|   **Reset Options**    | **Bit Field** | **Int Value** |
|------------------------|---------------|---------------|
| **Continuous Falling** | 0b000         | 0             |
| **Continuous Rising**  | 0b001         | 1             |
| **Disable Falling**    | 0b010         | 2             |
| **Disable Rising**     | 0b011         | 3             |
| **One-Shot Falling**   | 0b100         | 4             |
| **One-Shot Rising**    | 0b101         | 5             |

\* Reset Options utilizing both One-Shot and Disable bits are omitted from the table as there is conflicting behavior between these modes. See above for additional info.

## Update

No update operations can be performed on Conditional Reset.

## Read

Results are read from the following registers.

DIO#_EF_READ_A -- Returns the current count.

## Example

This example assumes that DIO0 has a running extended feature such as quadrature or a counter. Now we will set up DIO2 as a falling edge trigger that will reset the count of DIO0_EF.

`DIO2_EF_ENABLE = 0 // Ensure that the DIO-EF is not running so that it can be configured.`

`DIO2_EF_INDEX = 12 // Set to Conditional Reset`

`DIO2_EF_CONFIG_A = 0 // Falling edges`

`DIO2_EF_CONFIG_B = 1 // Reset every edges`

`DIO2_EF_CONFIG_C = 0 // Reset events clear the count of DIO0_EF`

`DIO2_EF_ENABLE = 1 // Turn on the DIO-EF`

Now falling edges on DIO2 will set the count of DIO0_EF to zero.

For a more detailed walkthrough, see [Configuring \& Reading a Counter](https://support.labjack.com/docs/configuring-reading-a-counter.md).

## Edge Rate Limits

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based. To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second. If stream mode is active, the limit is reduced to 20k edges/second. Excessive processor loading (e.g. a busy Lua script) can also reduce these limits. Note that interrupt features must process all edges, rising \& falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete. When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel. Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts). When an ISR completes, it clears the IF for that channel. So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A \& B have an edge occur at the same time and an ISR starts to process the edge on channel A. If channel A has another edge during the first 14 μs, that edge will be lost. If channel B has another edge during the first 14 μs, the initial edge will be lost. If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

---
language: "en"
---
# 13.2.2 PWM Out \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO6, DIO7** (aka FIO6, FIO7)

T7 Capable DIO: **DIO0, DIO2, DIO3, DIO4, DIO5** (aka FIO0, FIO2, FIO3, FIO4, FIO5)

T8 Capable DIO: **DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO11, DIO12** (aka FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO3, EIO4)

Requires Clock Source: **Yes**

Index: **0**

Streamable: **No**

This PWM Out Extended Feature generates a pulse width modulated wave form.

## Operation

PWM output will set the DIO high and low relative to the clock source's count. When the count is zero the DIO line will be set high. When the count matches Config A the line will be set low. Therefore Config A is used to control the duty cycle and the resolution is equal to the roll value.

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`PWMFrequency = Clock#Frequency / DIO_EF_CLOCK#_ROLL_VALUE`

`DutyCycle% = 100 * DIO#_EF_CONFIG_A / DIO_EF_CLOCK#_ROLL_VALUE`

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

DIO_EF_CLOCK#_ROLL_VALUE is a 32-bit value for CLOCK0 and a 16-bit value for CLOCK1 \& CLOCK2. A value of 0 corresponds to the max roll value of 2^32^ for the 32-bit clock or 2^16^ for 16-bit clocks.

PWM Out is capable of glitch-free updates in most situations. A glitch-free update means that the PWM will finish the current period consisting of the high time then the low time before loading the new value. The next period will then have the new duty cycle. This is true for all cases except zero. When setting the duty cycle to zero, the line will be set low regardless of the current position. This means that a single high pulse with duration between zero and the previous high time can be output before the line goes low.

The clock roll value can take up to one PWM period to update and this does not block subsequent commands from being processed. It is possible to finish updating DIO_EF_CONFIG_A to a value greater than the non-updated clock roll value (which is invalid) but less than the updated clock roll value (which is valid) and throw the error 2565: EF_VALUE_GREATER_THAN_PERIOD.

Potential fixes:

* disable and re-enable the clock line before updating the clock roll value and duty cycle value.

* Delay for greater than one "non-updated" PWM period between updating the clock roll value and updating the duty cycle value

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 0

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: When the specified clocks source's count matches this value, the line will transition from high to low.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

## Update

The duty cycle can be updated at any time. To update, write the new value to DIO#_EF_CONFIG_A. The new value will not be used until the clock source rolls to zero. This means that at the end of the current period, the new value will be loaded---resulting in a glitch-free transition.

## Read

No information is returned by PWM Out.

## Reset

Reset has no effect on this feature.

## Example

To generate a 10 kHz PWM starting at 25% DC, first configure the clock source. The higher the roll value, the greater the duty cycle resolution will be. For the highest resolution, you must maximize the roll value, so use the smallest clock divisor that will not result in a roll value greater than the clock source's size (32-bits or 16-bits). For a more detailed walkthrough, see [Configuring a PWM Output](https://support.labjack.com/docs/configuring-a-pwm-output.md).

### T4/T7 Pseudocode

With a divisor of 1, the roll value will be 8000:

`80 MHz / (1 * 8000) = 10 kHz`

Set the clock registers accordingly:

`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 1`

`DIO_EF_CLOCK0_ROLL_VALUE = 8000`

`DIO_EF_CLOCK0_ENABLE = 1`

Once the clock source is configured, we can use the roll value to calculate CONFIG_A:

`DC = 25% = 100 * CONFIG_A / 8000`

`CONFIG_A = 25 * 8000 / 100 = 2000`

Now the PWM can be turned on by writing to the proper registers (use DIO4 on the T4):

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 0`

`DIO0_EF_CONFIG_A = 2000`

`DIO0_EF_ENABLE = 1`

### T8 Pseudocode

With a divisor of 1, the roll value will be 10000:

`100 MHz / (1 * 10000) = 10 kHz`

Set the clock registers accordingly:

`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 1`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000`

`DIO_EF_CLOCK0_ENABLE = 1`

Once the clock source is configured, we can use the roll value to calculate CONFIG_A:

`DC = 25% = 100 * CONFIG_A / 10000`

`CONFIG_A = 25 * 10000 / 100 = 2500`

Now the PWM can be turned on by writing to the proper registers:

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 0`

`DIO0_EF_CONFIG_A = 2500`

`DIO0_EF_ENABLE = 1`

---
language: "en"
---
# 13.2.3 PWM Out with Phase \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO6, DIO7** (aka FIO6, FIO7)

T7 Capable DIO: **DIO0, DIO2, DIO3, DIO4, DIO5** (aka FIO0, FIO2, FIO3, FIO4, FIO5)

T8 Capable DIO: **DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO11, DIO12** (aka FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO3, EIO4)

Requires Clock Source: **Yes**

Index: **1**

Streamable: **No**

This PWM Out with Phase Extended Feature is similar to the [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md) DIO-EF, but allows for phase control.

## Operation

PWM Output with Phase control generates PWM waveforms with the pulse positioned at different points in the period. This is achieved by setting the DIO line high and low relative to the clock source's count.

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`PWMFrequency = Clock#Frequency / DIO_EF_CLOCK#_ROLL_VALUE`

`DutyCycle% = 100 * (DIO#_EF_CONFIG_A - DIO#_EF_CONFIG_B) / DIO_EF_CLOCK#_ROLL_VALUE`

`PhaseOffset = 360º * DIO#_EF_CONFIG_A / DIO_EF_CLOCK#_ROLL_VALUE`

When the count matches CONFIG_B, the DIO line will be set high. When the count matches CONFIG_A, the line will be set low. Therefore CONFIG_B minus CONFIG_A controls the duty cycle.

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

DIO_EF_CLOCK#_ROLL_VALUE is a 32-bit value for CLOCK0 and a 16-bit value for CLOCK1 \& CLOCK2. A value of 0 corresponds to the max roll value of 2^32^ for the 32-bit clock or 2^16^ for 16-bit clocks.

The clock roll value can take up to one PWM period to update and this does not block subsequent commands from being processed. It is possible to finish updating DIO_EF_CONFIG_A or DIO_CONFIG_B to a value greater than the non-updated clock roll value (which is invalid) but less than the updated clock roll value (which is valid) and throw the error 2565: EF_VALUE_GREATER_THAN_PERIOD.

Potential fixes:

* disable and re-enable the clock line before updating the clock roll value and duty cycle value.

* Delay for greater than one "non-updated" PWM period between updating the clock roll value and updating the duty cycle value

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 1

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: When the clock source's count matches this value the line will transition from high to low.

DIO#_EF_CONFIG_B: When the clock source's count matches this value the line will transition from low to high.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

## Update

The duty cycle can be updated at any time. To update, write the new value to CONFIG_A then CONFIG_B. The value written to CONFIG_A is stored until CONFIG_B is written. After writing CONFIG_B, the new value will be loaded at the start of the next period. Updates are glitch-less unless switching from a very high to very low duty cycle or a very low to very high duty cycle.

DIO#_EF_CONFIG_A: Values written here will set the new falling position. The new value will not take effect until CONFIG_B is written.

DIO#_EF_CONFIG_B: Values written here will set the new rising position. When CONFIG_B is written, the new CONFIG_A is also loaded.

## Read

No information is returned by PWM Out with Phase.

## Reset

Reset has no affect on this feature.

## Example

See the [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md) documentation for an example.

---
language: "en"
---
# 13.2.4 Pulse Out \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO6, DIO7** (aka FIO6, FIO7)

T7 Capable DIO: **DIO0, DIO2, DIO3, DIO4, DIO5** (aka FIO0, FIO2, FIO3, FIO4, FIO5)

T8 Capable DIO: **DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO11, DIO12** (aka FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO3, EIO4)

Requires Clock Source: **Yes**

Index: **2**

Streamable: **No**

Pulse output will generate a specified number of pulses and then stop. For continuous pulse output use the PWM Out feature.

## Operation

The high time and the low time are specified relative to the clock source the same way as [PWM with Phase](https://support.labjack.com/docs/13-2-3-pwm-out-with-phase-t-series-datasheet.md).

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`PulseOutFrequency = Clock#Frequency / DIO_EF_CLOCK#_ROLL_VALUE`

if CONFIG_A \> CONFIG_B:

`DutyCycle% = 100 * (DIO#_EF_CONFIG_A - DIO#_EF_CONFIG_B) / DIO_EF_CLOCK#_ROLL_VALUE`

For the common case that CONFIG_B is fixed at 0:

`DutyCycle% = 100 * DIO#_EF_CONFIG_A / DIO_EF_CLOCK#_ROLL_VALUE`

For a 50% duty cycle:

`DIO#_EF_CONFIG_A = DIO_EF_CLOCK#_ROLL_VALUE / 2`

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

DIO_EF_CLOCK#_ROLL_VALUE is a 32-bit value for CLOCK0 and a 16-bit value for CLOCK1 \& CLOCK2. A value of 0 corresponds to the max roll value of 2^32^ for the 32-bit clock or 2^16^ for 16-bit clocks.

The clock roll value can take up to one pulse out period to update and this does not block subsequent commands from being processed. It is possible to finish updating DIO_EF_CONFIG_A or DIO_EF_CONFIG_B to a value greater than the non-updated clock roll value (which is invalid) but less than the updated clock roll value (which is valid) and throw the error 2565: EF_VALUE_GREATER_THAN_PERIOD.

Potential fixes:

* disable and re-enable the clock line before updating the clock roll value and line transition values.

* Delay for greater than one "non-updated" period between updating the clock roll value and updating the line transition values.

The pulse out mode is very CPU intensive when running at higher frequencies (for example, above 400 kHz). At higher rates the number of pulses should be low to limit execution time, or one of the PWM output modes should be used instead.

## Configure

DIO#: First set the DIO line low (DIO#=0). The line must start low for proper pulse generation.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 2

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: When the specified clock source's count matches this value the line will transition from high to low.

DIO#_EF_CONFIG_B: When the specified clock source's count matches this value the line will transition from low to high.

DIO#_EF_CONFIG_C: The number of pulses to generate.

DIO#_EF_CONFIG_D: Not used.

## Update

DIO#_EF_CONFIG_A: Sets a new high to low transition point. Will take effect when writing CONFIG_C.

DIO#_EF_CONFIG_B: Sets a new low to high transition point. Will take effect when writing CONFIG_C.

DIO#_EF_CONFIG_C: Writing to this value will start a new pulse sequence. If a sequence is already in progress it will be aborted. Numbers previously written to CONFIG_A or CONFIG_B will take effect when CONFIG_C is written.

## Read

Results are read from the following registers.

DIO#_EF_READ_A: The number of pulses that have been completed.

DIO#_EF_READ_B: The target number of pulses.

## Reset

DIO#_EF_READ_A_AND_RESET: Reads the number of pulses that have been completed, then restarts the pulse sequence. If the requested number of pulses has not been completed the count will be restarted. Eg: If configured to output 10 pulses and only 4 have transpired when the reset is executed, then a total of 14 pulses will be generated.

## Example

Set up a 1 kHz output with 20% duty cycle.

### T4/T7 Pseudocode

First, configure the DIO_EF clock source:

`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 8`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000`

`DIO_EF_CLOCK0_ENABLE = 1`

`Clock0Frequency = 80 MHz / 8 = 10 MHz`

`PWMFrequency = 10 MHz / 10000 = 1 kHz`

Once the clock source is configured, you can configure the pulse output.

Disable the feature:

`DIO0_EF_ENABLE = 0`

Set DIO0 to output low (use DIO4 on the T4):

`DIO0 = 0`

User the pulse out index:

`DIO0_EF_INDEX = 2`

Configure high to low counts:

`DIO0_EF_CONFIG_A = 2000`

`duty cycle = 100 * (2000 - 0) / 10000 = 20%`

Configure low to high counts:

`DIO0_EF_CONFIG_B = 0`

Configure the number of pulses:

`DIO0_EF_CONFIG_C = 5000`

`pulseRuntime = 5000 pulses / 1000 pulses/second = 5 seconds`

Enable the feature:

`DIO0_EF_ENABLE = 1`

### T8 Pseudocode

First, configure the DIO_EF clock source:

`DIO_EF_CLOCK0_ENABLE = 0`

`DIO_EF_CLOCK0_DIVISOR = 16`

`DIO_EF_CLOCK0_ROLL_VALUE = 6250`

`DIO_EF_CLOCK0_ENABLE = 1`

`Clock0Frequency = 100 MHz / 16 = 6.25 MHz`

`PWMFrequency = 6.25 MHz / 6250 = 1 kHz`

Once the clock source is configured, you can configure the pulse output.

Disable the feature:

`DIO0_EF_ENABLE = 0`

Set DIO0 to output low:

`DIO0 = 0`

User the pulse out index:

`DIO0_EF_INDEX = 2`

Configure high to low counts:

`DIO0_EF_CONFIG_A = 1250`

`duty cycle = 100 * (1250 - 0) / 6250 = 20%`

Configure low to high counts:

`DIO0_EF_CONFIG_B = 0`

Configure the number of pulses:

`DIO0_EF_CONFIG_C = 5000`

`pulseRuntime = 5000 pulses / 1000 pulses/second = 5 seconds`

Enable the feature:

`DIO0_EF_ENABLE = 1`

---
language: "en"
---
# 13.2.5 Frequency In \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5** (aka FIO4, FIO5)

T7 Capable DIO: **DIO0, DIO1** (aka FIO0, FIO1)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO8, DIO11, DIO13** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, EIO0, EIO3, EIO5)

Requires Clock Source: **Yes**

Index: **3 (positive edges) or 4 (negative edges)**

Streamable: **Yes---integer READ registers only.**

Frequency In will measure the period or frequency of a digital input signal by counting the number of clock source ticks between two edges: rising-to-rising (index=3) or falling-to-falling (index=4).

## Operation

The number of ticks can be read from DIO#_EF_READ_A.

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`Period (s) = DIO#_EF_READ_A / Clock#Frequency`

`Frequency (Hz) = Clock#Frequency / DIO#_EF_READ_A`

`Resolution(s) = 1 / Clock#Frequency`

`Max Period(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency`

Frequency In works best with periodic signals. Due to a hardware constraint, the first edge is often missed. That can cause confusing results when the signal is not periodic. For measuring non-perioidic singles we recommend [L2L](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet.md).

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

Roll value for this feature would typically be left at the default of 0, which is the max value (2\^32 for the 32-bit Clock0), but you might be forced to use a lower roll value due to another needed feature such as [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md).

A couple of typical scenarios with roll value = 0 and using the 32-bit clock (Clock0):

* Divisor = 1, Resolution = 12.5 nanoseconds, MaxPeriod = 53.7 seconds

* Divisor = 256, Resolution = 3.2 microseconds, MaxPeriod = 229 minutes

Only Clock0 is 32-bit. Clock1 and Clock2 are both 16-bit. Usage of Clock1 or Clock2 would decrease the maximum roll value to 216.  
If you are also using the PWM Out feature, note that the PWM output frequency cannot be measured using the frequency in feature when using the same DIO_EF clock.

Consider using the [Interrupt Frequency Input feature](https://support.labjack.com/docs/13-2-12-interrupt-frequency-in-t-series-datasheet.md) for measurement instead.

By default, Frequency In operates in one-shot mode where it will measure the frequency once after being enabled and a new measurement only once after each read of a READ_A register. The other option is continuous mode, where the frequency is constantly measured (every edge is processed) and READ registers return the most recent result. Running in continuous mode puts a greater load on the processor.

If you do another read before a new edge has occurred, you will get the same value as before. Some applications will want to use the read-and-reset option so that a value is only returned once and extra reads will return 0. (See Reset below.)

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 3 or 4

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Default = 0. Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: Default = 0. Bit 1: 0 = one-shot, 1 = continuous. All other bits reserved.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

**One-Shot**

When one-shot mode is enabled, the DIO_EF will complete a measurement then go idle. No more measurements will be made until the DIO_EF has been read or reset.

**Continuous**

When continuous mode is enabled, the DIO_EF will repeatedly make measurements. If a new reading is completed before the old one has been read the old one will be discarded.

**CONFIG_A Value Map**

To configure the DIO_EF measurement mode, refer to the table below for the mapping between the bit field value and the corresponding integer value which should be written to DIO#_EF_CONFIG_A.  

| Measurement Mode | Bit Field | Int Value |
|------------------|-----------|-----------|
| **One-Shot**     | 0b00      | 0         |
| **Continuous**   | 0b10      | 2         |

## Update

No update operations can be performed on Frequency In.

## Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the period in ticks. If a full period has not yet been observed this value will be zero.

DIO#_EF_READ_B: Returns the same value as READ_A.

DIO#_EF_READ_A_F: Returns the period in seconds. If a full period has not yet been observed this value will be zero.

DIO#_EF_READ_B_F: Returns the frequency in Hz. If a full period has not yet been observed this value will be zero.

Note that all "READ_B" registers are capture registers. All "READ_B" registers are only updated when any "READ_A" register is read. Thus it would be unusual to read any B registers without first reading at least one A register.

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Reset

DIO#_EF_READ_A_AND_RESET: Returns the same data as DIO#_EF_READ_A and then clears the result so that zero is returned by subsequent reads until another full period is measured (2 new edges).

Note that even in continuous mode, with reads happening faster than the signal frequency using a _RESET read will result in measurements of every other cycle not every cycle.

## Example

Most applications can use default clock settings, so to configure frequency input on DIO0 you can simply write the following register sequence:

`DIO_EF_CLOCK0_ENABLE = 1`

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 3`

`DIO0_EF_ENABLE = 1`

Now you can read the period in seconds from a 4th register DIO0_EF_READ_A_F.

### Roll Value Considerations

Sometimes, other DIO-EF might interact with this feature. For example, roll value would usually be set to 0 to provide the maximum measurable period, but assume that we have to use 10000 because it is set to that for PWM output on another channel:

**T4/T7:**

`DIO_EF_CLOCK0_DIVISOR = 8 // Divisor used for PWM. 80 MHz / 8 = 10 MHz clock`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000 // Roll value used for PWM`

**T8:**

`DIO_EF_CLOCK0_DIVISOR = 16 // Divisor used for PWM. 100 MHz / 16 = 6.25 MHz clock`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000 // Roll value used for PWM`

This clock configuration results in:

`Resolution = 1 / 6.25 MHz = 0.16 us`

`MaxPeriod = 10000 / 6.25 MHz = 1.6 ms`

For a more detailed walkthrough, see [Configuring \& Reading Frequency](https://support.labjack.com/docs/configuring-reading-frequency.md).

## Rate Limits

The maximum measurable frequency varies based on the one-shot setting, concurrent stream rate, and other DIO-EFs set to an input mode.

### One-shot or Continuous

When one-shot is enabled, the T-series devices will take a single measurement, then wait for a READ_A register to be read before taking another measurement. This means that with one-shot, only a small fraction of the total periods of a signal are measured. One-shot allows for higher maximum measurable frequency than continuous does.

### Stream

The stream process is the highest priority process on T-series devices. When stream needs the processor, all other operations are put on hold. That hold occurs more frequently at higher stream speeds. When a DIO-EF process has to wait, the max frequency that can be measured is reduced.

### Multiple DIO-EFs

DIO-EFs on other different lines also require processor time. The amount of processor time required depends on the signal being processed and the DIO-EF's settings. The maximum frequencies in the below table give the total max frequency for all running DIO-EFs---divide the max frequencies below by the number of enabled DIO-EFs to get the max frequency for each individual DIO-EF.

Refer to the following table for maximum measurable frequencies in various combinations of stream and one-shot.  

| Index  | One-shot or Continuous |    Stream Rate     | Max Frequency |
|--------|------------------------|--------------------|---------------|
| 3 or 4 | Continuous             | Stream not running | 200 kHz       |
| 3 or 4 | One-shot               | Stream not running | 750 kHz       |
| 3 or 4 | Continuous             | 10 kHz             | 75 kHz        |
| 3 or 4 | One-shot               | 10 kHz             | 750 kHz       |
| 3 or 4 | Continuous             | 100 kHz            | 20 kHz        |
| 3 or 4 | One-shot               | 100 kHz            | 250 kHz       |
| 5      | Continuous             | Stream not running | 200 kHz       |
| 5      | One-shot               | Stream not running | 750 kHz       |
| 5      | Continuous             | 10 kHz             | 75 kHz        |
| 5      | One-shot               | 10 kHz             | 750 kHz       |
| 5      | Continuous             | 100 kHz            | 20 kHz        |
| 5      | One-shot               | 100 kHz            | 250 kHz       |

---
language: "en"
---
# 13.2.6 Pulse Width In \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5** (aka FIO4, FIO5)

T7 Capable DIO: **DIO0, DIO1** (aka FIO0, FIO1)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO8, DIO11, DIO13** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, EIO0, EIO3, EIO5)

Requires Clock Source: **Yes**

Index: **5**

Streamable: **Yes---integer READ registers only.**

Pulse Width In will measure the high time and low time of a digital input signal, by counting the number of clock source ticks while the signal is high and low. This could also be referred to as duty-cycle input or PWM input.

## Operation

The number of high ticks can be read from DIO#_EF_READ_A and the number of low ticks can be read from DIO#_EF_READ_B.

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`HighTime(s) = DIO#_EF_READ_A / Clock#Frequency`

`LowTime(s) = DIO#_EF_READ_B / Clock#Frequency`

`Resolution(s) = 1 / Clock#Frequency`

`Max High or Low Time(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency`

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

Roll value for this feature would typically be left at the default of 0, which is the max value (2^32^ for the 32-bit Clock0), but you might be using a lower roll value for another feature such as [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md).

A couple typical scenarios with roll value = 0 and using the 32-bit clock (Clock0):

* Divisor = 1, Resolution = 12.5 nanoseconds, MaxTime = 53.7 seconds

* Divisor = 256, Resolution = 3.2 microseconds, MaxTime = 229 minutes

Only Clock0 is 32-bit. Clock1 and Clock2 are both 16-bit. Usage of Clock1 or Clock2 would decrease the maximum roll value to 216.

If you are also using the PWM Out feature, note that the PWM output frequency cannot be measured using the frequency in feature when using the same DIO_EF clock.

Once this feature is enabled, a new measurement happens on every applicable edge and both result registers are updated on every rising edge. If you do another read before a new rising edge has occurred, you will get the same values as before. Many applications will want to use the read-and-reset option so that a value is only read once and extra reads will return 0. (See Reset below.)

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 5

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Default = 0. Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: Default = 0. Bit 1: 0 = one-shot, 1 = continuous. All other bits reserved.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

**One-Shot**

When one-shot mode is enabled, the DIO_EF will complete a measurement then go idle. No more measurements will be made until the DIO_EF has been read or reset.

**Continuous**

When continuous mode is enabled, the DIO_EF will repeatedly make measurements. If a new reading is completed before the old one has been read the old one will be discarded.

**CONFIG_A Value Map**

To configure the DIO_EF measurement mode, refer to the table below for the mapping between the bit field value and the corresponding integer value which should be written to DIO#_EF_CONFIG_A.  

| Measurement Mode | Bit Field | Int Value |
|------------------|-----------|-----------|
| **One-Shot**     | 0b00      | 0         |
| **Continuous**   | 0b10      | 2         |

## Update

No update operations can be performed on Pulse Width In.

## Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the measured high time in clock source ticks and saves the low time so that it can be read later. If a full period has not yet been observed this value will be zero.

DIO#_EF_READ_B: Returns the measured low time in clock source ticks. This is a capture register ... it is only updated when one of the READ_A registers is read.

DIO#_EF_READ_A_F: Returns the measured high time in seconds and saves the low time so that it can be read later. If a full period has not yet been observed this value will be zero.

DIO#_EF_READ_B_F: Returns the measured low time in seconds. This is a capture register ... it is only updated when one of the READ_A registers is read.

Only reading one of the "READ_A" registers will trigger a new measurement. All "READ_B" registers are capture registers, and they are only updated when any "READ_A" register is read.

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Reset

DIO#_EF_READ_A_AND_RESET: Performs the same read as READ_A, but then also clears the register so that zero is returned until another full period is measured.

DIO#_EF_READ_A_F_AND_RESET: Performs the same read as READ_A_F, but then also clears the register so that zero is returned until another full period is measured.

## Example

### **T4/T7**

First, configure the clock source. Roll value should usually be set to 0 for PWM-in to provide the maximum measurable period. Assume for this example that we have to use 10000 for the roll value because a PWM output on another channel uses the same clock source (clock 0).

`DIO_EF_CLOCK0_DIVISOR = 8 // Divisor used for PWM. 80 MHz / 8 = 10 MHz clock`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000 // Roll value required for PWM output on another channel`

This clock configuration results in:

`Resolution = 1 / 10 MHz = 0.1 us`

`MaxPeriod = 10000 / 10 MHz = 1 ms`

With these settings, the PWM-in feature could not measure a signal with a period greater than 1 ms.

Configure the DIO_EF on DIO0 (FIO0) as pulse width input\*:

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 5 // Pulse width input feature.`

`DIO0_EF_OPTIONS = 0 // Set to use clock source zero.`

`DIO0_EF_CONFIG_A = 2 // Use Continuous measurement mode`

`DIO0_EF_ENABLE = 1 // Enable the DIO_EF`

After a full period (rising edge, falling edge, rising edge) has occurred, the values are stored in the result registers. This repeats at each rising edge. READ_A and READ_A_F both return the high time and save the low time that can be read from READ_B and READ_B_F. This ensures that both readings are from the same waveform cycle.

~\*The T4 does not support this feature on DIO0, so you might use DIO4 (FIO4) on the T4 instead. For example, configure DIO4_EF_ENABLE.~

### **T8**

First, configure the clock source. Roll value should usually be set to 0 for PWM-in to provide the maximum measurable period. Assume for this example that we have to use 10000 for the roll value because a PWM output on another channel uses the same clock source (clock 0).

`DIO_EF_CLOCK0_DIVISOR = 16 // Divisor used for PWM. 100 MHz / 16 = 6.25 MHz clock`

`DIO_EF_CLOCK0_ROLL_VALUE = 10000 // Roll value used for PWM`

This clock configuration results in:

`Resolution = 1 / 6.25 MHz = 0.16 us`

`MaxPeriod = 10000 / 6.25 MHz = 1.6 ms`

With these settings, the PWM-in feature could not measure a signal with a period greater than 1.6 ms.

Now configure the DIO_EF on DIO0 as pulse width input:

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 5 // Pulse width input feature.`

`DIO0_EF_OPTIONS = 0 // Set to use clock source zero.`

`DIO0_EF_CONFIG_A = 2 // Use Continuous measurement mode`

`DIO0_EF_ENABLE = 1 // Enable the DIO_EF`

After a full period (rising edge, falling edge, rising edge) has occurred, the values are stored in the result registers. This repeats at each rising edge. READ_A and READ_A_F both return the high time and save the low time that can be read from READ_B and READ_B_F. This ensures that both readings are from the same waveform cycle.

## Rate Limits

The maximum measurable frequency varies based on the one-shot setting, concurrent stream rate, and other DIO-EFs set to an input mode.

### One-shot or Continuous

When one-shot is enabled, the T-series devices will take a single measurement, then wait for a READ_A register to be read before taking another measurement. This means that with one-shot, only a small fraction of the total periods of a signal are measured. One-shot allows for higher maximum measurable frequency than continuous does.

### Stream

The stream process is the highest priority process on T-series devices. When stream needs the processor, all other operations are put on hold. That hold occurs more frequently at higher stream speeds. When a DIO-EF process has to wait, the max frequency that can be measured is reduced.

### Multiple DIO-EFs

DIO-EFs on other different lines also require processor time. The amount of processor time required depends on the signal being processed and the DIO-EF's settings. The maximum frequencies in the below table give the total max frequency for all running DIO-EFs---divide the max frequencies below by the number of enabled DIO-EFs to get the max frequency for each individual DIO-EF.

Refer to the following table for maximum measurable frequencies in various combinations of stream and one-shot.  

| Index  | One-shot or Continuous |    Stream Rate     | Max Frequency |
|--------|------------------------|--------------------|---------------|
| 3 or 4 | Continuous             | Stream not running | 200 kHz       |
| 3 or 4 | One-shot               | Stream not running | 750 kHz       |
| 3 or 4 | Continuous             | 10 kHz             | 75 kHz        |
| 3 or 4 | One-shot               | 10 kHz             | 750 kHz       |
| 3 or 4 | Continuous             | 100 kHz            | 20 kHz        |
| 3 or 4 | One-shot               | 100 kHz            | 250 kHz       |
| 5      | Continuous             | Stream not running | 200 kHz       |
| 5      | One-shot               | Stream not running | 750 kHz       |
| 5      | Continuous             | 10 kHz             | 75 kHz        |
| 5      | One-shot               | 10 kHz             | 750 kHz       |
| 5      | Continuous             | 100 kHz            | 20 kHz        |
| 5      | One-shot               | 100 kHz            | 250 kHz       |

---
language: "en"
---
# 13.2.7 Line-to-Line In \[T-Series Datasheet\]

## Overview

T4 Capable DIO: **DIO4, DIO5** (aka FIO4, FIO5)

T7 Capable DIO: **DIO0, DIO1** (aka FIO0, FIO1)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO8, DIO11, DIO13** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, EIO0, EIO3, EIO5)

Requires Clock Source: **Yes**

Index: **6**

Streamable: **No**

Line-to-line mode can be used to measure the time between edge transition points on two supported DIO.

**T4/T7 -**The measurement occurs between the lower DIO number edge and the upper DIO edge. For example, the time between a falling edge on DIO0 and the next falling edge on DIO1 when using a T7.

**T8** - The measurement occurs between the combination of edges selected. Either DIO can trigger the measurement.

## Operation

`Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR`

`Time(s) = DIO#_EF_READ_A / Clock#Frequency`

`Resolution(s) = 1 / Clock#Frequency`

`Max Time(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency`

See the [DIO-EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) section for more information about your device core frequency and DIO_EF clock source settings.

Roll value for this feature would typically be left at the default of 0, which is the max value (2\^32 for the 32-bit Clock0), but you might be using a lower roll value for another feature such as [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md).

A couple typical scenarios with roll value = 0 and using the 32-bit clock (Clock0):

* Divisor = 1, Resolution = 12.5 nanoseconds, MaxPeriod = 53.7 seconds

* Divisor = 256, Resolution = 3.2 microseconds, MaxPeriod = 229 minutes

Line-to-Line In operates in a one-shot mode. Once the specified combination of edges is observed, the data is saved and measuring stops. Another measurement can be started by resetting or performing the configuration procedure again. If no measurement has occurred yet, attempting to read any measurement registers will return 0.

## Configure

Configuring Line-to-Line In requires configuring two digital I/O lines (see [capable DIO](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet.md#Overview) here) as Line-to-Line In feature index 6. The first DIO configured should be the one expecting the first edge. Any extended features on either DIO should be disabled before beginning configuration.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 6

DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Default = 0. Specify which [clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) to use. **0** for Clock0, **1** for Clock1, or **2** for Clock2.

DIO#_EF_CONFIG_A: 0 = falling edge. 1 = rising edge.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

## Update

No update operations can be performed on Line-to-Line In.

## Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the one-shot measured time in clock source ticks. If the specified combination of edges has not yet been observed this value will be zero. Both configured DIO#s return the same value.

DIO#_EF_READ_A_F: Returns the time in seconds. If the specified combination of edges has not yet been observed this value will be zero.

DIO#_EF_READ_B: Returns 1 for the DIO# which detected the first edge, otherwise it returns 0.

**Important note:**Before reading DIO#_EF_READ_B, you must read DIO#_EF_READ_A or DIO#_EF_READ_A_F on either DIO to read a valid result. If this prerequisite read is not performed, DIO#_EF_READ_B will always return 0.

## Reset

DIO#_EF_READ_A_AND_RESET: Performs the same operation as DIO#_EF_READ_A, then clears the result and starts another measurement. Also clears the READ_A values on the paired DIO#.

## Example

This shows how to setup Line-to-Line for detecting a falling edge on DIO0 and DIO1 with the maximum measurement resolution using clock source 0.

First, disable and configure the clock source:

    DIO_EF_CLOCK0_ENABLE = 0      // Disable the clock source
    DIO_EF_CLOCK0_DIVISOR = 1     // Set the divsor
    DIO_EF_CLOCK0_ROLL_VALUE = 0  // Set the roll value

On the T4 and T7 this clock configuration results in:

`Resolution = 1 / 80 MHz = 12.5 ns`

`MaxPeriod = 232/ 80 MHz = 53.7 seconds`

On the T8 this clock configuration results in:

`Resolution = 1 / 100 MHz = 10 ns`

`MaxPeriod = 232/ 100 MHz = 42.9 seconds`

Now disable and configure the DIO-EF on DIO0 and DIO1 as line-to-line (use DIO4 and DIO5 on the T4):

    DIO0_EF_ENABLE = 0   // Disable DIO-EF
    DIO1_EF_ENABLE = 0   // Disable DIO-EF

    DIO0_EF_INDEX = 6     // Index for line-to-line feature.
    DIO0_EF_OPTIONS = 0   // Select the clock source.
    DIO0_EF_CONFIG_A = 0  // Detect falling edge.

    DIO1_EF_INDEX = 6     // Index for line-to-line feature.
    DIO1_EF_OPTIONS = 0   // Select the clock source.
    DIO1_EF_CONFIG_A = 0  // Detect falling edge.

And finally, enable both DIO-EF and then the clock source to ensure synced results:

    DIO0_EF_ENABLE = 1        // Turn on the DIO-EF
    DIO1_EF_ENABLE = 1        // Turn on the DIO-EF

    DIO_EF_CLOCK0_ENABLE = 1  // Enable the clock source

At this point the device is watching DIO0 for a falling edge. Once that happens it watches for a falling edge on DIO1. Finally after that, it stores the ticks or time between those 2 edges, which you can read from the READ registers described above.

To get a measurement, keep reading either DIO0_EF_READ_A or DIO0_EF_READ_A_F until a non-zero value is reported, indicating a measurement occurred.

    ticks_between_edges = 0

    while (ticks_between_edges == 0)
      ticks_between_edges = DIO0_EF_READ_A  // Keep reading until measurement

    if DIO0_EF_READ_B == 1
      // DIO0 saw the edge first
    else 
      // DIO1 saw the edge first

To do another measurement, repeat this example, or read from DIO0_EF_READ_A_AND_RESET or DIO0_EF_READ_A_F_AND_RESET.

## Rate Limits

Line-to-line can achieve high resolution while requiring very little processor time. The time between the edges can be as little as 50 ns. Once a measurement has been completed the system will not measure again until reconfigured or reset. Unless you are reading at a high rate, line-to-line will have little impact on other systems.

If running at a high rate, it is recommended to follow the [Example](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet.md#Example) on how to correctly setup the DIO_EF and clock source to ensure both DIO_EFs start on the same clock cycle.

---
language: "en"
---
# 13.2.8 High-Speed Counter \[T-Series Datasheet\]

## Overview

High speed counters use hardware to count at faster rates with less processor overhead. There are some features which internally use the same hardware. Those features can not be used at the same time as their associated counter.

High-speed counters are only available on certain IO lines. The below lists indicate which IOs support high-speed counter:

* **T4/T7** Capable DIO: **DIO16, DIO17, DIO18, DIO19** (aka CIO0, CIO1, CIO2, CIO3)

* **T8** Capable DIO: **DIO6, DIO7, DIO8, DIO10, DIO13, DIO14, DIO15**(aka FIO6, FIO7, EIO0, EIO2, EIO5, EIO6, EIO7)

Requires Clock Source: **No**

Index: **7**

Streamable: **Yes---integer READ registers only.**

## Shared hardware (mutually exclusive features)

**T4 and T7** devices support up to 4 high-speed rising-edge counters that use hardware to achieve [high count rates](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md). These counters are shared with other resources. If any of the features listed are in use, then high speed counter can not be used on that line.

* (DIO16/CIO0): Used by DIO_EF Clock0 \& Clock1.

* (DIO17/CIO1): Used by DIO_EF Clock0 \& Clock2.

* (DIO18/CIO2): Used by the asynchronous serial communication feature on the T4. Always available on the T7.

* (DIO19/CIO3): Used by stream mode.

**The T8** supports up to 7 high-speed rising-edge counters that use hardware to achieve [high count rates](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md). These counters are shared with other resources as follows:

* DIO14/EIO6: Used by EF Clock0 \& Clock1.

* DIO15/EIO7: Used by EF Clock0 \& Clock2.

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 7

DIO#_EF_CLOCK_SOURCE: Not used.

DIO#_EF_CONFIG_A: Not used.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_C: Not used.

DIO#_EF_CONFIG_D: Not used.

## Update

No update operations can be performed with High-Speed Counter.

## Read

Results are read from the following register.

DIO#_EF_READ_A: Returns the current count which is incremented on each rising edge.

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Reset

DIO#_EF_READ_A_AND_RESET: Reads the current count then clears the counter. There is a brief period of time between reading and clearing during which edges can be missed. During normal operation this time period is 10-30 µs. If missed edges at this point are not acceptable, then do not use reset but rather just note the "virtual reset" counter value in software and subtract it from other values.

## Frequency Measurement

Counters are often used to measure frequency by taking change in count over change in time:

`Frequency = (CurrentCount - PreviousCount) / (CurrentTimestamp - PreviousTimestamp)`

Typically the timestamps are from the host clock (software), but for more accurate timestamps read the CORE_TIMER register in the same Modbus packet as the READ registers. See the [System Timing Register](https://support.labjack.com/docs/4-0-hardware-overview-t-series-datasheet.md) section for more information about the CORE_TIMER.

Also note that other [digital extended features](https://support.labjack.com/docs/13-2-dio-extended-features-t-series-datasheet.md) are available to measure frequency by timing individual pulses rather than counting over time.

## Example

Enable a high speed counter on DIO18/CIO2 (use DIO6 for the T8):

`DIO18_EF_ENABLE = 0`

`DIO18_EF_INDEX = 7`

`DIO18_EF_ENABLE = 1`

Enable a high speed counter on DIO17/CIO1 (use DIO14 for the T8):

`DIO_EF_CLOCK0_ENABLE = 0 //Make sure Clock0 is disabled.`

`DIO_EF_CLOCK2_ENABLE = 0 //Make sure Clock2 is disabled.`

`DIO17_EF_ENABLE = 0`

`DIO17_EF_INDEX = 7`

`DIO17_EF_ENABLE = 1`

Results can be read from the READ registers defined above.

## Edge Rate Limits

See [Appendix A-2](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md).

---
language: "en"
---
# 13.2.9 Interrupt Counter \[T-Series Datasheet\]

Overview

T4 Capable DIO: **DIO4, DIO5, DIO6, DIO7, DIO8, DIO9** (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO6, DIO7** (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: **DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15** (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: **No**

Index: **8**

Streamable: **Yes---integer READ registers only.**

Interrupt Counter counts the rising edge of pulses on the associated IO line. This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. See the discussion of edge rate limits at the bottom of this page.

## Configure

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable

DIO#_EF_INDEX: 8

DIO#_EF_CLOCK_SOURCE: Not used.

DIO#_EF_CONFIG_A: Not used.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_B: Not used.

DIO#_EF_CONFIG_B: Not used.

There are 3 basic techniques for device configuration:

1. Power-up defaults. Most registers related to I/O configuration are part of the [Device Configuration](https://support.labjack.com/docs/24-0-device-configuration-t-series-datasheet.md) system where their boot-up values can be defined by the user. This is easily done with the [Power-up Defaults tab](https://support.labjack.com/docs/general-configuration.md) in Kipling.

2. Real time software configuration. Software can write any needed configuration values at the beginning of execution, but you might have to consider how to handle if the device later reboots during software execution. An advantage to this method is that a factory device will work out-of-the-box without requiring the user to first configure the device.

3. Startup script. A [Lua script](https://support.labjack.com/docs/25-0-lua-scripting-t-series-datasheet.md) can be set to run at startup and can write any values to any registers.

## Update

No update operations can be performed on Interrupt Counter.

## Read

Results are read from the following register.

DIO#_EF_READ_A: Returns the current Count

## Stream Read

All operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode. In [stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the [Stream Section](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md) those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Reset

DIO#_EF_READ_A_AND_RESET: Reads the current count then clears the counter. Note that there is a brief period of time between reading and clearing during which edges can be missed. During normal operation this time period is 10-30 µs. If missed edges at this point can not be tolerated then reset should not be used.

## Frequency Measurement

Counters are often used to measure frequency by taking change in count over change in time:

Frequency = (CurrentCount - PreviousCount) / (CurrentTimestamp - PreviousTimestamp)

Typically the timestamps are from the host clock (software), but for more accurate timestamps read the CORE_TIMER register in the same Modbus packet as the READ registers. See the [System Timing Register](https://support.labjack.com/docs/4-0-hardware-overview-t-series-datasheet.md) section for more information about the CORE_TIMER.

Also note that other [digital extended features](https://support.labjack.com/docs/13-2-dio-extended-features-t-series-datasheet.md) are available to measure frequency by timing individual pulses rather than counting over time.

## Example

Enable a counter on DIO0 (use DIO4 on the T4):

`DIO0_EF_ENABLE = 0`

`DIO0_EF_INDEX = 8`

`DIO0_EF_ENABLE = 1`

Use the [Register Matrix](https://support.labjack.com/docs/register-matrix.md) in Kipling to write those 2 registers above, and also add DIO0_EF_READ_A so you see its value. Now take a wire connected to a GND terminal and tap that wire to the inside-back of the DIO0 screw-terminal (labeled "FIO0"). DIO0_EF_READ_A should increment by 1 or more counts each time you tap the ground wire in DIO0.

As another test you can set DAC1_FREQUENCY_OUT_ENABLE = 1 to enable the 10 Hz test signal (T7 requires firmware 1.0234+). Jumper DAC1 to DIO0 and you should see DIO0_EF_READ_A increment by about 10 counts per second.

For a more detailed walkthrough, see [Configuring \& Reading a Counter](https://support.labjack.com/docs/configuring-reading-a-counter.md).

## Edge Rate Limits

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based. To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second. If stream mode is active, the limit is reduced to 20k edges/second. Excessive processor loading (e.g. a busy Lua script) can also reduce these limits. Note that interrupt features must process all edges, rising \& falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete. When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel. Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts). When an ISR completes, it clears the IF for that channel. So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A \& B have an edge occur at the same time and an ISR starts to process the edge on channel A. If channel A has another edge during the first 14 μs, that edge will be lost. If channel B has another edge during the first 14 μs, the initial edge will be lost. If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

---
language: "en"
---
# 13.2 DIO Extended Features \[T-Series Datasheet\]

## Overview

**Basics:** DIO Extended Features, commonly refered to as "DIO-EF", allow T-Series devices to measure and generate digital waveforms that are more advanced than logic high or logic low. They expose features such as PWM output for servo motor control, Quadrature input for [incremental/quadrature encoders](https://en.wikipedia.org/wiki/Rotary_encoder), and more.

**Device Control Basics:**

* All T-series device features are controlled by reading and writing Modbus TCP registers via Modbus TCP (either directly or through our [LJM library](https://support.labjack.com/docs/ljm-library-overview.md)).

* We have register descriptions throughout documentation detailing relevant register names, starting addresses, types, and access permissions (read/write).

* See [Section 3.0 Communication](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) for other detailed communication information.

**Register Numbering:** DIO-EFs are configured and used through the DIO#(0:22)_EF registers. The numbering of these registers corresponds with the DIO numbers documented in section [13.0 Digital I/O](https://support.labjack.com/docs/13-0-digital-i-o-t-series-datasheet.md).

**Configuration and how to use:** The meanings of each of the DIO#_EF_CONFIG registers and DIO#_EF_READ registers changes depending on what DIO-EF index (DIO#_EF_INDEX) is configured, however the general configuration process is the same and is described below. It is helpful to think of DIO-EF features as "sub-systems" that need to be configured before they are started. Once they are started, they can be interacted with by reading the system state and updating system configurations.

DIO-EF System Configurations:

1. Select a feature and determine the number of required DIO lines using the reference tables below.

2. Ensure that the DIO-EF is disabled by writing a 0 to the appropriate DIO#_EF_ENABLE register.

3. If required by the selected DIO-EF feature, configure the [DIO-EF clock source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md).

4. Write the selected feature's index value to the appropriate DIO#_EF_INDEX register.

5. If required by the selected DIO-EF feature, write to the DIO#_EF_CLOCK_SOURCE register.

6. If required by the selected DIO-EF feature, write to the DIO#_EF_CONFIG registers.

7. Enable the selected DIO-EF feature by writing a 1 to the appropriate DIO#_EF_ENABLE register.

Once a DIO-EF has been started, it can be interacted with using the following registers

* If the selected DIO-EF produces data, read the results from the DIO#_EF_READ registers.

* *(E.g., if DIO6 is configured as an* [*Interrupt Counter*](https://support.labjack.com/docs/13-2-9-interrupt-counter-t-series-datasheet.md)*, you can read the current count from DIO6_EF_READ_A.)*

* If the selected DIO-EF can be updated on the fly, write to the DIO#_EF_CONFIG registers.

* *(E.g., if DIO0 is configured as a* [*PWM Out*](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet.md)*, you can update the duty cycle by writing to DIO0_EF_CONFIG_A.)*

**Supported Features by Device**

Each T-series device supports DIO extended features on different IO. The following sections outline feature availability by device.

T4  
**Table 13.2-1.**T4 Digital I/O Extended Features  

|------------------------------------------------------------------------------------------------------------------------|------------|-------|-------|-------|-------|-------|-------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|
| T4 Digital I/O Extended Features                                                                                                   || **FIO (4-7)**              |||| **EIO (0-7)**                                                |||||||| **CIO (0-3)**                  ||||
| T4 Digital I/O Extended Features                                                                                                   || **DIO**                                                                                                                  ||||||||||||||||
| **Feature**                                                                                                            | **Index#** | **4** | **5** | **6** | **7** | **8** | **9** | **10** | **11** | **12** | **13** | **14** | **15** | **16** | **17** | **18** | **19** |
| [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet)                                          | **0**      |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |
| [PWM Out with Phase](https://support.labjack.com/docs/13-2-3-pwm-out-with-phase-t-series-datasheet)                    | **1**      |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |
| [Pulse Out](https://support.labjack.com/docs/13-2-4-pulse-out-t-series-datasheet)                                      | **2**      |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |
| [Frequency In](https://support.labjack.com/docs/13-2-5-frequency-in-t-series-datasheet)                                | **3,4**    | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |
| [Pulse Width In](https://support.labjack.com/docs/13-2-6-pulse-width-in-t-series-datasheet)                            | **5**      | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |
| [Line-to-Line In](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet)\*                        | **6**      | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |
| [High-Speed Counter](https://support.labjack.com/docs/13-2-8-high-speed-counter-t-series-datasheet)                    | **7**      |       |       |       |       |       |       |        |        |        |        |        |        | ✔      | ✔      | ✔      | ✔      |
| [Interrupt Counter](https://support.labjack.com/docs/13-2-9-interrupt-counter-t-series-datasheet)                      | **8**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |        |        |        |        |        |        |        |        |        |        |
| [Interrupt Counter with Debounce](https://support.labjack.com/docs/13-2-10-interrupt-counter-with-debounce-t-series-d) | **9**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |        |        |        |        |        |        |        |        |        |        |
| [Quadrature In](https://support.labjack.com/docs/13-2-11-quadrature-in-t-series-datasheet)\*                           | **10**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |        |        |        |        |        |        |        |        |        |        |
| [Interrupt Frequency In](https://support.labjack.com/docs/13-2-12-interrupt-frequency-in-t-series-datasheet)           | **11**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |        |        |        |        |        |        |        |        |        |        |
| [Conditional Reset](https://support.labjack.com/docs/13-2-13-conditional-reset-t-series-datasheet)                     | **12**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |        |        |        |        |        |        |        |        |        |        |

\*Line-to-Line In and Quadrature In both require two DIO lines.
T7  
**Table 13.2-2.**T7 Digital I/O Extended Features  

|------------------------------------------------------------------------------------------------------------------------|------------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|
| T7 Digital I/O Extended Features                                                                                                   || **FIO (0-7)**                                          |||||||| **EIO (0-7)**                                                |||||||| **CIO (0-3)**                  |||| **MIO (0-2)**          |||
| T7 Digital I/O Extended Features                                                                                                   || **DIO**                                                                                                                                                                      |||||||||||||||||||||||
| **Feature**                                                                                                            | **Index#** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** | **10** | **11** | **12** | **13** | **14** | **15** | **16** | **17** | **18** | **19** | **20** | **21** | **22** |
| [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet)                                          | **0**      | ✔     |       | ✔     | ✔     | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [PWM Out with Phase](https://support.labjack.com/docs/13-2-3-pwm-out-with-phase-t-series-datasheet)                    | **1**      | ✔     |       | ✔     | ✔     | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Pulse Out](https://support.labjack.com/docs/13-2-4-pulse-out-t-series-datasheet)                                      | **2**      | ✔     |       | ✔     | ✔     | ✔     | ✔     |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Frequency In](https://support.labjack.com/docs/13-2-5-frequency-in-t-series-datasheet)                                | **3,4**    | ✔     | ✔     |       |       |       |       |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Pulse Width In](https://support.labjack.com/docs/13-2-6-pulse-width-in-t-series-datasheet)                            | **5**      | ✔     | ✔     |       |       |       |       |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Line-to-Line In](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet)\*                        | **6**      | ✔     | ✔     |       |       |       |       |       |       |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [High-Speed Counter](https://support.labjack.com/docs/13-2-8-high-speed-counter-t-series-datasheet)                    | **7**      |       |       |       |       |       |       |       |       |       |       |        |        |        |        |        |        | ✔      | ✔      | ✔      | ✔      |        |        |        |
| [Interrupt Counter](https://support.labjack.com/docs/13-2-9-interrupt-counter-t-series-datasheet)                      | **8**      | ✔     | ✔     | ✔     | ✔     |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Interrupt Counter with Debounce](https://support.labjack.com/docs/13-2-10-interrupt-counter-with-debounce-t-series-d) | **9**      | ✔     | ✔     | ✔     | ✔     |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Quadrature In](https://support.labjack.com/docs/13-2-11-quadrature-in-t-series-datasheet)\*                           | **10**     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Interrupt Frequency In](https://support.labjack.com/docs/13-2-12-interrupt-frequency-in-t-series-datasheet)           | **11**     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |
| [Conditional Reset](https://support.labjack.com/docs/13-2-13-conditional-reset-t-series-datasheet)                     | **12**     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     | ✔     |       |       |        |        |        |        |        |        |        |        |        |        |        |        |        |

\*Line-to-Line In and Quadrature In both require two DIO lines.
T8  
**Table 13.2-3.**T8 Digital I/O Extended Features  

|------------------------------------------------------------------------------------------------------------------------|------------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|
| T8 Digital I/O Extended Features                                                                                                   || **FIO (0-7)**                                          |||||||| **EIO (0-7)**                                                |||||||| **CIO (0-3)**                  ||||
| T8 Digital I/O Extended Features                                                                                                   || **DIO**                                                                                                                                              ||||||||||||||||||||
| **Feature**                                                                                                            | **Index#** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** | **10** | **11** | **12** | **13** | **14** | **15** | **16** | **17** | **18** | **19** |
| [PWM Out](https://support.labjack.com/docs/13-2-2-pwm-out-t-series-datasheet)                                          | **0**      |       |       | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |        | ✔      | ✔      |        |        |        |        |        |        |        |
| [PWM Out with Phase](https://support.labjack.com/docs/13-2-3-pwm-out-with-phase-t-series-datasheet)                    | **1**      |       |       | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |        | ✔      | ✔      |        |        |        |        |        |        |        |
| [Pulse Out](https://support.labjack.com/docs/13-2-4-pulse-out-t-series-datasheet)                                      | **2**      |       |       | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |        | ✔      | ✔      |        |        |        |        |        |        |        |
| [Frequency In](https://support.labjack.com/docs/13-2-5-frequency-in-t-series-datasheet)                                | **3,4**    | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     |       |        | ✔      |        | ✔      |        |        |        |        |        |        |
| [Pulse Width In](https://support.labjack.com/docs/13-2-6-pulse-width-in-t-series-datasheet)                            | **5**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     |       |        | ✔      |        | ✔      |        |        |        |        |        |        |
| [Line-to-Line In](https://support.labjack.com/docs/13-2-7-line-to-line-in-t-series-datasheet)\*                        | **6**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     |       |       | ✔     |       |        | ✔      |        | ✔      |        |        |        |        |        |        |
| [High-Speed Counter](https://support.labjack.com/docs/13-2-8-high-speed-counter-t-series-datasheet)                    | **7**      |       |       |       |       |       |       | ✔     | ✔     | ✔     |       | ✔      |        |        | ✔      | ✔      | ✔      |        |        |        |        |
| [Interrupt Counter](https://support.labjack.com/docs/13-2-9-interrupt-counter-t-series-datasheet)                      | **8**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔      | ✔      | ✔      | ✔      | ✔      | ✔      |        |        |        |        |
| [Interrupt Counter with Debounce](https://support.labjack.com/docs/13-2-10-interrupt-counter-with-debounce-t-series-d) | **9**      | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔      | ✔      | ✔      | ✔      | ✔      | ✔      |        |        |        |        |
| [Quadrature In](https://support.labjack.com/docs/13-2-11-quadrature-in-t-series-datasheet)\*                           | **10**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔      | ✔      | ✔      | ✔      | ✔      | ✔      |        |        |        |        |
| [Interrupt Frequency In](https://support.labjack.com/docs/13-2-12-interrupt-frequency-in-t-series-datasheet)           | **11**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔      | ✔      | ✔      | ✔      | ✔      | ✔      |        |        |        |        |
| [Conditional Reset](https://support.labjack.com/docs/13-2-13-conditional-reset-t-series-datasheet)                     | **12**     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔     | ✔      | ✔      | ✔      | ✔      | ✔      | ✔      |        |        |        |        |

\*Line-to-Line In and Quadrature In both require two DIO lines.

**Kipling Walkthroughs** : Kipling's [Register Matrix](https://support.labjack.com/docs/register-matrix.md) can be used to perform DIO-EF features. Some examples:

* [Configuring \& Reading a Counter](https://support.labjack.com/docs/configuring-reading-a-counter.md)

* [Configuring \& Reading Frequency](https://support.labjack.com/docs/configuring-reading-frequency.md)

* [Configuring a PWM Output](https://support.labjack.com/docs/configuring-a-pwm-output.md)

## DIO-EF Enable/Disable

This register is used to disable a DIO-EF feature (in order to configure it) and also used to start or enable the DIO-EF subsystem.

A DIO-EF doesn't always need to be disabled for it to be configured, depending on the DIO-EF being enabled.

## DIO-EF Index (Feature Selection)

This register is used to select the extended feature that will get enabled on a given DIO line. The valid DIO lines differ by device. For more specific details look at reference tables 13.2-1 and 13.2-2 as well as the appropriate DIO-EF feature subsection.

## DIO-EF Clock Source Selection

This register isn't used by all DIO-EF features.

If a DIO-EF feature requires the configuration or selection of a clock source (such as PWM Out does), the configuration of this register is required, since it is required for selecting a clock source. See [13.2.1 EF Clock Source](https://support.labjack.com/docs/13-2-1-ef-clock-source-t-series-datasheet.md) for more details about clock source selection.

## DIO-EF Configuration

Configuration registers serve two purposes. They provide a location for settings that need to be configured upon DIO-EF enable and they provide a location for settings that users may need to use to update a DIO-EF feature once it has been enabled.

**Initial Configuration:** Configuration is the initial setup of the Extended Feature. Configuration requires that any DIO-EF running at the pin in question first be disabled. Options can then be loaded. Then the DIO-EF can be enabled.

**Update:** Some DIO#_CONFIG registers can be updated while a DIO-EF is running. Updating allows the DIO-EF to change its operation parameters without restarting. Note that the clock source and feature index cannot be changed in an update. Depending on the feature, reads and writes to the update registers have small differences. See the Update portion of each feature for more information.

## DIO-EF Basic Read Registers

Some DIO-EF produce results or provide status information that can be read. This information is usually a binary integer. When possible, the T-series device will convert the binary integer into a real-world unit such as seconds. When available, converted values can be read from the registers designated with "_F".

## DIO-EF Read-and-Reset Registers

Some DIO-EF can be reset while they are running. Resetting can have different results depending on the feature. For instance, counters are reset to zero.

## Streaming DIO-EF Results

Though all operations discussed in this section are supported in [command-response](https://support.labjack.com/docs/3-0-communication-t-series-datasheet.md) mode, some DIO-EF features can be read fast enough to be [streamed](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md):

* Frequency In

* Pulse Width In

* High-Speed Counter

* Interrupt Counter

* Interrupt Counter with Debounce

* Quadrature In

* Interrupt Frequency In

In stream mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in [3.2 Stream](https://support.labjack.com/docs/3-2-stream-mode-t-series-datasheet.md), those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.

## Other Considerations

### Specifications

See [Appendix A-2](https://support.labjack.com/docs/a-2-digital-i-o-t-series-datasheet.md) for specs including:

* Frequency Output

* Counter Input Frequency

* Minimum High \& Low Time

* "Interrupt" Total Edge Rate

### System Timer

Complications can occur if streaming while enabling a DIO-EF that requires the use of a system timer. Please contact LabJack support if you need to do this.

[Next Page](https://support.labjack.com/llms-full.txt/1)
