Automatic flexible configuration for the T7 | LabJack

Automatic flexible configuration for the T7

12 posts / 0 new
Last post
cmartin's picture
Automatic flexible configuration for the T7

** For newcomers to the thread, check out the last post to see what the latest updates are **

I wrote a C-header that lets me configure the T7 through a .conf text file.  It has come in so handy, that I figured there's probably at least one other human being in the world who might find it useful.  I've set up a git repository here:   Check out the to get started. 

  • The lconfig.h header file has detailed documentation in its comments.
  • There are example .c codes implement the header
  • is a Python module that parses the config
  • is a Python module that parses the data files that the data file stream creates
  • The make*.sh files are my lazy version of a make file.

$ git clone

cmartin's picture
Version 2.02 is up.  There's

Version 2.02 is up.  There's much better documentation and some pre-compiled command line utilities for burst and stream operations.  More features are coming.

cmartin's picture
Version 2.03 is up.  I've

Version 2.03 is up.  I've included automatic configuration for most of the flexible digital I/O features supported by the T7.  Below is an example configuration file that the LCONFIG code uses to automatically configure PWM output on FIO0 and counter input on FIO2.

I haven't updated the pretty documentation yet, but detailed authoritative information on the configuration parameters and their behaviors is commented into the header file above the load_config() definition.

connection usb
serial 470014042

fiofrequency 1250

fiochannel 0
fiosignal pwm
fiodirection output
fioedge rising
fioduty 0.25

fiochannel 2
fiosignal count
fiodebounce fixed
fiousec 100

cmartin's picture
Version 3.00 is tested and

Version 3.00 is tested and posted.  LCONFIG has grown into more than a configuration system.  It includes a fully configurable software trigger with pre-trigger buffering, fully configurable function generator DAC channels, it supports most of the T7's FIO extended features, it includes two command-line utilities for Linux, and it has detailed documentation.

Version 3.00

The Python data analysis tools are now out of date, but they should still be backwards compatible to the analog settings.

Hi Chris,

Hi Chris,

Thanks for sharing! 


cmartin's picture
You bet, Nick.  The

You bet, Nick.  The repository is still a little messy; I really need to prune it.  If you have any difficulty getting up and running with it, post your questions here and I'll try to help out!

cmartin's picture

It has been a while since I've posted here, but the C- configuration code is now up to version 3.03.  The system includes text file configuration for streaming:

  • single-ended / differential AI
  • AI resolution
  • AI range
  • AI settling time
  • AI sample rate
  • Software trigger AI channel
  • Software trigger AI threshold
  • Software trigger rising, falling, or any edge
  • Digital hardware trigger on a counter input channel
  • Configurable pre-triggering

All streaming is handled automatically through a ring buffer implemented in the lconfig binaries, which also handles tests for software trigger events.

The drun and dburst linux binaries implement continuous long-interval streaming directly to a file and high speed short-interval streaming to memory before being saved to a file.  They are documented using -h switches, and are highly configurable.

For aplications that need FIO extended features, the LConfig system exposes API funcitons for interfacing with the FIO registers autoatically using the same configuration file interface as the AI streaming configuraiton parameters.

I use the LConfig system in my lab on the Linux Mint OS, but it should also be compatible with Ubuntu and many other Linux distros.  I have not tested the code for Windows compatibilitiy.

cmartin's picture

Version 3.04 has been forked to a new distribution, more appropriately named "LCONFIG"  The documentation has been updated, and I've finally added more robust post-processing and in-configuration calibration of signals.

I decided to make a fork to separate the specialized codes I use in my lab from the extensible utilities that folks here are likely to find useful.  I hope folks enjoy!



Thanks once again for sharing

Thanks once again for sharing Chris!


cmartin's picture
Version 3.06 of LConfig is

Version 3.06 of LConfig is posted.

1) There is a new live documentation that is hosted on github and downloads with the repository.

2) T4 support has been added

3) High speed digital input streaming is now supported alongside the existing analog streaming support

4) The device identification has been improved; device serial number and name were conflated in the previous implementation.

5) Python post processing documentation has been updated.

cmartin's picture
Version 4.06 is now live. 

Version 4.06 is now live.  Over the six years I have relied on this system for Linux-based data acquisition in my lab, I've added quite a few features, all of which can be automatically configured in a single ascii configuration file.  The automatic data management has made writing NSF data management plans a snap!

  1. Three pre-written binaries automate high-speed data collection, long-term continuous data collection, or realtime monitoring of an experiment.
  2. A fully documented API is available for custom applications that want to use the automatic configuration system.
  3. Analog inputs are automatically configured with human-readable text labels, custom linear calibration, engineering units, variable range, resolution, sample rate, and settling times. 
  4. Configuration support is extended to the T4 as well as the T7.
  5. Configuration parameters are automatically embedded with data files for a permanent record of how the experiment was performed.
  6. Users can insert meta configuration parameters for a detailed record of their experimental conditions - even those that aren't necessary for configuring the LabJack.
  7. Most of the LabJack DIO extended features are supported in both input and output modes
  8. LConfig automatically manages the analog outputs to make your very own function generators: constant, square, triangle, white noise, sine; each with shaped with a generous set of parameters.
  9. Both binary and ascii data file encodings are supported in both collection and post-processing
  10. There is a Python module for automatically managing data in post-processing.  I rely on it heavily.
  11. The whole system is documented
Thanks again Chris! 

Thanks again Chris! 

This will come in very handy on my next project.