Overview
Example code is a great way to get started writing a custom code.
Example code is a great way to get started writing a custom code.
Examples In... | Windows | Mac | Linux |
---|---|---|---|
C/C++ | ✔ | ✔ | ✔ |
LabVIEW | ✔ | ✔ | |
Python | ✔ | ✔ | ✔ |
Node.js | ✔ | ✔ | ✔ |
MATLAB | ✔ | ||
DAQFactory | ✔ | ||
Delphi | ✔ | ||
Java | ✔ | ✔ | ✔ |
.NET (C#, VB) | ✔ | ||
Processing | ✔ | ✔ | ✔ |
Visual Basic (VB6, VBA) | ✔ | ||
LabWindows/CVI | ✔ | ||
Agilent VEE | ✔ | ||
DASYLab | ✔ |
While the above examples are run on the host computer, there are also example Lua scripts which run on-board T-series devices.
There are also direct Modbus TCP examples that do not use LJM. Note that some features, such as streaming, are greatly simplified by the LJM library. A list of the available Modbus registers is available on the Modbus Map page.
Example code specifically tailored to the Digit-TL/Digit-TLH can be found in the appendix-b section of the Digit's datasheet.
Examples In... | Windows | Mac | Linux |
---|---|---|---|
DAQFactory | ✔ | ||
LabVIEW | ✔ | ||
C, C++, VC6 | ✔ | ||
C, C++ | ✔ | ✔ | |
Python | ✔ | ✔ | ✔ |
Visual Basic (VB6, VBA) | ✔ | ||
.Net (C#, VB) | ✔ | ||
Java | ✔ | ||
Delphi | ✔ | ||
MATLAB | ✔ | ||
Agilent VEE | ✔ | ||
Igor Pro | ✔ | ||
PureBasic | ✔ | ||
LabWindows/CVI | ✔ | ||
DASYLab | ✔ |
Libraries... | Windows | Mac | Linux |
---|---|---|---|
LabVIEW | ✔ | ✔ | ✔ |
Node.js | ✔ | ✔ | ✔ |
Python | ✔ | ✔ | ✔ |
C/C++ (Streaming) | ✔ | ✔ | ✔ |
C# .NET | ✔ |
To use a 3rd party Modbus program, such as a Rockwell/Allen Bradley application, follow the instructions on the Modbus Client Applications page.
More information about Modbus as well as some getting started information can be found on the Modbus API Documentation page. A list of the available Modbus registers is available on the Modbus Map page.
The UE9 is also compatible with the direct Modbus TCP examples. A list of the available modbus registers that the UE9 supports is available in the UD Modbus section.
Note that some features, such as streaming, are simplified by the UD library.
Lua Scripts run on the device rather than on a computer. This allows for unique control of T-series devices. It's especially useful for time-sensitive applications, digital communication, and standalone operation. The included examples are a great place to start writing a custom program. Lua scripts can use USER_RAM registers to pass data into other programs.
Lua scripts are uploaded to the T-series device through Kipling, which makes Lua scripting possible across all platforms (Windows, macOS, and Linux).
Examples In... | Windows | Mac | Linux |
---|---|---|---|
C/C++ | ✔ | ✔ | ✔ |
LabVIEW | ✔ | ✔ | |
Python | ✔ | ✔ | ✔ |
Node.js | ✔ | ✔ | ✔ |
MATLAB | ✔ | ||
DAQFactory | ✔ | ||
Delphi | ✔ | ||
Java | ✔ | ✔ | ✔ |
.NET (C#, VB) | ✔ | ||
Processing | ✔ | ✔ | ✔ |
Visual Basic (VB6, VBA) | ✔ | ||
LabWindows/CVI | ✔ | ||
Agilent VEE | ✔ | ||
DASYLab | ✔ |
While the above examples are run on the host computer, there are also example Lua scripts which run on-board T-series devices.
There are also direct Modbus TCP examples that do not use LJM. Note that some features, such as streaming, are greatly simplified by the LJM library. A list of the available Modbus registers is available on the Modbus Map page.
Example code specifically tailored to the Digit-TL/Digit-TLH can be found in the appendix-b section of the Digit's datasheet.
C/C++ examples for the LJM library. Also contains some header files:
Updated for LJM 1.2100.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2021-08-20.zip $ cd C_C++_LJM_2021-08-20 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-3.1.1/scons.py
Updated for LJM 1.2001.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-05-20.zip $ cd C_C++_LJM_2019-05-20 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.2001.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-05-20-beta.zip $ cd C_C++_LJM_2019-05-20 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.2000.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-03-27-beta.zip $ cd C_C++_LJM_2019-03-27 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.2000.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-03-27-beta.zip $ cd C_C++_LJM_2019-03-27 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.2000.
New changes:
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-03-27_beta.zip $ cd C_C++_LJM_2019-03-27 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.2000.
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2019-02-20.zip $ cd C_C++_LJM_2019-02-20 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.1900.
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2018-10-02.zip $ cd C_C++_LJM_2018-10-02 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.1700.
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions:
$ tar zxvf C_C++_LJM_2018-01-05.zip $ cd C_C++_LJM_2018-01-05 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
Updated for LJM 1.1405.
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux:
$ tar zxvf C_C++_LJM_2017-02-01.zip $ cd C_C++_LJM_2017-02-01 $ chmod a+x examples/make*.sh examples/*/make.sh scons-local-2.1.0/scons.py
Updated for LJM 1.1404.
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux:
$ tar zxvf C_C++_LJM_2017-01-11.zip $ cd C_C++_LJM_2017-01-11 $ chmod a+x examples/make*.sh examples/*/make.sh scons-local-2.1.0/scons.py
Updated for LJM 1.1301.
On Mac/Linux the .zip format, unfortunately, removes the execution permissions from the build scripts. To use the examples on Mac/Linux:
$ tar zxvf C_C++_LJM_2016-08-10.zip $ cd C_C++_LJM_2016-08-10 $ chmod a+x examples/make*.sh examples/*/make.sh scons-local-2.1.0/scons.py
Windows:
Newer versions of Visual Studio work with these .sln and .vcproj files, though you will need to run the automatic upgrade process when opening them.
For Visual Studio 2017, you may get the following error:
Error C1083 Cannot open include file: 'stdio.h': No such file or directory
In this case, you need to switch the project SDK version from 8.1 to 10:
Mac/Linux:
On Mac/Linux, the .zip format unfortunately removes the execution permissions from the build scripts. To use the examples on Mac/Linux, you may need to apply executable permissions. For example:
$ tar zxvf C_C++_LJM_2019-05-20.zip $ cd C_C++_LJM_2019-05-20 $ chmod a+x make_all.sh basic/make.sh more/*/make.sh scons-local-2.5.1/scons.py
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. The following examples in the Basic folder are a great place to start:
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Stream mode and other operations that don't fit in "Write Read Loop with Config" will usually have specific examples, and if something seems to be missing let us know.
To compile a C or C++ program that uses LJM see the compilation instructions, which include instructions for compiling programs including:
#include <stdio.h> #include <LabJackM.h> #include "LJM_Utilities.h" // Available in the C/C++ examples download. Provides the ErrorCheck function. int main() { int err, handle; double value = 0; const char * NAME = {"SERIAL_NUMBER"}; // Open first found LabJack err = LJM_Open(LJM_dtANY, LJM_ctANY, "LJM_idANY", &handle); ErrorCheck(err, "LJM_Open"); // Call LJM_eReadName to read the serial number from the LabJack. err = LJM_eReadName(handle, NAME, &value); ErrorCheck(err, "LJM_eReadName"); printf("eReadName result:\n"); printf(" %s = %f\n", NAME, value); // Close device handle err = LJM_Close(handle); ErrorCheck(err, "LJM_Close"); return LJME_NOERROR; }
C_C++_LJM_2019-03-27.zip contains:
README
scons-local-2.5.1/scons.py (as well as SConstruct files for each example folder)
CHANGES.txt
LabJackMModbusMap.h
LJM_StreamUtilities.h
LJM_Utilities.h
make_all.sh
basic\eAddresses.c
basic\eAddresses.exe
basic\eNames.c
basic\eNames.exe
basic\eReadAddress.c
basic\eReadAddress.exe
basic\eReadAddresses.c
basic\eReadAddresses.exe
basic\eReadName.c
basic\eReadName.exe
basic\eReadNames.c
basic\eReadNames.exe
basic\eWriteAddress.c
basic\eWriteAddress.exe
basic\eWriteAddresses.c
basic\eWriteAddresses.exe
basic\eWriteName.c
basic\eWriteName.exe
basic\eWriteNames.c
basic\eWriteNames.exe
basic\make.sh
basic\write_read_loop_with_config.c
basic\write_read_loop_with_config.exe
more\1-wire\1-wire.c
more\1-wire\1-wire.exe
more\1-wire\make.sh
more\ain\dual_ain_loop.c
more\ain\dual_ain_loop.exe
more\ain\make.sh
more\ain\single_ain.c
more\ain\single_ain.exe
more\ain\single_ain_with_config.c
more\ain\single_ain_with_config.exe
more\asynch\make.sh
more\asynch\uart_loopback_test.c
more\asynch\uart_loopback_test.exe
more\config\make.sh
more\config\read_config.c
more\config\read_config.exe
more\config\read_device_name_string.c
more\config\read_device_name_string.exe
more\config\write_device_name_string.c
more\config\write_device_name_string.exe
more\config\write_power_config.c
more\config\write_power_config.exe
more\dio\make.sh
more\dio\single_dio_read.c
more\dio\single_dio_read.exe
more\dio\single_dio_write.c
more\dio\single_dio_write.exe
more\dio_ef\dio_ef_config_1_pwm_and_1_counter.c
more\dio_ef\dio_ef_config_1_pwm_and_1_counter.exe
more\dio_ef\make.sh
more\ethernet\make.sh
more\ethernet\read_ethernet_config.c
more\ethernet\read_ethernet_config.exe
more\ethernet\read_ethernet_mac.c
more\ethernet\read_ethernet_mac.exe
more\ethernet\write_ethernet_config.c
more\ethernet\write_ethernet_config.exe
more\i2c\i2c_eeprom.c
more\i2c\i2c_eeprom.exe
more\i2c\make.sh
more\list_all\list_all.c
more\list_all\list_all.exe
more\list_all\list_all_extended.c
more\list_all\list_all_extended.exe
more\list_all\make.sh
more\sd\change_directory.cpp
more\sd\change_directory.exe
more\sd\delete_file.cpp
more\sd\delete_file.exe
more\sd\get_disk_info.cpp
more\sd\get_disk_info.exe
more\sd\list_directory.cpp
more\sd\list_directory.exe
more\sd\make.sh
more\sd\print_working_directory.cpp
more\sd\print_working_directory.exe
more\sd\read_file.cpp
more\sd\read_file.exe
more\sd\sd_util.hpp
more\spi\make.sh
more\spi\spi.c
more\spi\spi.exe
more\stream\make.sh
more\stream\stream_basic.c
more\stream\stream_basic.exe
more\stream\stream_basic_with_stream_out.c
more\stream\stream_basic_with_stream_out.exe
more\stream\stream_burst.c
more\stream\stream_burst.exe
more\stream\stream_callback.c
more\stream\stream_callback.exe
more\stream\stream_external_clock.c
more\stream\stream_external_clock.exe
more\stream\stream_out_only.c
more\stream\stream_out_only.exe
more\stream\stream_out_update.c
more\stream\stream_out_update.exe
more\stream\stream_sequential_ain.c
more\stream\stream_sequential_ain.exe
more\stream\stream_triggered.c
more\stream\stream_triggered.exe
more\testing\auto_reconnect_test.c
more\testing\auto_reconnect_test.exe
more\testing\c-r_speed_test.c
more\testing\c-r_speed_test.exe
more\testing\externally_clocked_stream_test.c
more\testing\externally_clocked_stream_test.exe
more\testing\make.sh
more\testing\stream_burst_test.c
more\testing\stream_burst_test.exe
more\testing\system_reboot_test.c
more\testing\system_reboot_test.exe
more\testing\write_read_loop_with_config_speed_test_eNames.c
more\testing\write_read_loop_with_config_speed_test_eNames.exe
more\utilities\device_info.c
more\utilities\device_info.exe
more\utilities\error.c
more\utilities\error.exe
more\utilities\lua_script_basic.c
more\utilities\lua_script_basic.exe
more\utilities\make.sh
more\utilities\names_to_addresses.c
more\utilities\names_to_addresses.exe
more\utilities\raw_bytes.c
more\utilities\raw_bytes.exe
more\utilities\read_cal.c
more\utilities\read_cal.exe
more\utilities\read_ljm_config.c
more\utilities\read_ljm_config.exe
more\utilities\set_timeout.cpp
more\utilities\set_timeout.exe
more\utilities\stepwise_feedback.c
more\utilities\stepwise_feedback.exe
more\utilities\t7_tcp_configure.c
more\utilities\t7_tcp_configure.exe
more\utilities\thermocouple_example.c
more\utilities\thermocouple_example.exe
more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking.c
more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking.exe
more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking.sln
more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking.vcproj
more\watchdog\make.sh
more\watchdog\read_watchdog_config.c
more\watchdog\read_watchdog_config.exe
more\watchdog\write_watchdog_config.c
more\watchdog\write_watchdog_config.exe
more\wifi\make.sh
more\wifi\read_wifi_config.c
more\wifi\read_wifi_config.exe
more\wifi\read_wifi_mac.c
more\wifi\read_wifi_mac.exe
more\wifi\read_wifi_rssi.c
more\wifi\read_wifi_rssi.exe
more\wifi\write_wifi_config.c
more\wifi\write_wifi_config.exe
visual_studio_2008\basic\eAddresses\eAddresses.sln
visual_studio_2008\basic\eAddresses\eAddresses.vcproj
visual_studio_2008\basic\eNames\eNames.sln
visual_studio_2008\basic\eNames\eNames.vcproj
visual_studio_2008\basic\eReadAddress\eReadAddress.sln
visual_studio_2008\basic\eReadAddress\eReadAddress.vcproj
visual_studio_2008\basic\eReadAddresses\eReadAddresses.sln
visual_studio_2008\basic\eReadAddresses\eReadAddresses.vcproj
visual_studio_2008\basic\eReadName\eReadName.sln
visual_studio_2008\basic\eReadName\eReadName.vcproj
visual_studio_2008\basic\eReadNames\eReadNames.sln
visual_studio_2008\basic\eReadNames\eReadNames.vcproj
visual_studio_2008\basic\eWriteAddress\eWriteAddress.sln
visual_studio_2008\basic\eWriteAddress\eWriteAddress.vcproj
visual_studio_2008\basic\eWriteAddresses\eWriteAddresses.sln
visual_studio_2008\basic\eWriteAddresses\eWriteAddresses.vcproj
visual_studio_2008\basic\eWriteName\eWriteName.sln
visual_studio_2008\basic\eWriteName\eWriteName.vcproj
visual_studio_2008\basic\eWriteNames\eWriteNames.sln
visual_studio_2008\basic\eWriteNames\eWriteNames.vcproj
visual_studio_2008\basic\write_read_loop_with_config\write_read_loop_with_config.sln
visual_studio_2008\basic\write_read_loop_with_config\write_read_loop_with_config.vcproj
visual_studio_2008\more\1-wire\1-wire\1-wire.sln
visual_studio_2008\more\1-wire\1-wire\1-wire.vcproj
visual_studio_2008\more\ain\dual_ain_loop\dual_ain_loop.sln
visual_studio_2008\more\ain\dual_ain_loop\dual_ain_loop.vcproj
visual_studio_2008\more\ain\single_ain\single_ain.sln
visual_studio_2008\more\ain\single_ain\single_ain.vcproj
visual_studio_2008\more\ain\single_ain_with_config\single_ain_with_config.sln
visual_studio_2008\more\ain\single_ain_with_config\single_ain_with_config.vcproj
visual_studio_2008\more\asynch\uart_loopback_test\uart_loopback_test.sln
visual_studio_2008\more\asynch\uart_loopback_test\uart_loopback_test.vcproj
visual_studio_2008\more\config\read_config\read_config.sln
visual_studio_2008\more\config\read_config\read_config.vcproj
visual_studio_2008\more\config\read_device_name_string\read_device_name_string.sln
visual_studio_2008\more\config\read_device_name_string\read_device_name_string.vcproj
visual_studio_2008\more\config\write_device_name_string\write_device_name_string.sln
visual_studio_2008\more\config\write_device_name_string\write_device_name_string.vcproj
visual_studio_2008\more\config\write_power_config\write_power_config.sln
visual_studio_2008\more\config\write_power_config\write_power_config.vcproj
visual_studio_2008\more\dio\single_dio_read\single_dio_read.sln
visual_studio_2008\more\dio\single_dio_read\single_dio_read.vcproj
visual_studio_2008\more\dio\single_dio_write\single_dio_write.sln
visual_studio_2008\more\dio\single_dio_write\single_dio_write.vcproj
visual_studio_2008\more\dio_ef\dio_ef_config_1_pwm_and_1_counter\dio_ef_config_1_pwm_and_1_counter.sln
visual_studio_2008\more\dio_ef\dio_ef_config_1_pwm_and_1_counter\dio_ef_config_1_pwm_and_1_counter.vcproj
visual_studio_2008\more\ethernet\read_ethernet_config\read_ethernet_config.sln
visual_studio_2008\more\ethernet\read_ethernet_config\read_ethernet_config.vcproj
visual_studio_2008\more\ethernet\read_ethernet_mac\read_ethernet_mac.sln
visual_studio_2008\more\ethernet\read_ethernet_mac\read_ethernet_mac.vcproj
visual_studio_2008\more\ethernet\write_ethernet_config\write_ethernet_config.sln
visual_studio_2008\more\ethernet\write_ethernet_config\write_ethernet_config.vcproj
visual_studio_2008\more\i2c\i2c_eeprom\i2c_eeprom.sln
visual_studio_2008\more\i2c\i2c_eeprom\i2c_eeprom.vcproj
visual_studio_2008\more\list_all\list_all\list_all.sln
visual_studio_2008\more\list_all\list_all\list_all.vcproj
visual_studio_2008\more\list_all\list_all_extended\list_all_extended.sln
visual_studio_2008\more\list_all\list_all_extended\list_all_extended.vcproj
visual_studio_2008\more\sd\change_directory\change_directory.sln
visual_studio_2008\more\sd\change_directory\change_directory.vcproj
visual_studio_2008\more\sd\delete_file\delete_file.sln
visual_studio_2008\more\sd\delete_file\delete_file.vcproj
visual_studio_2008\more\sd\get_disk_info\get_disk_info.sln
visual_studio_2008\more\sd\get_disk_info\get_disk_info.vcproj
visual_studio_2008\more\sd\list_directory\list_directory.sln
visual_studio_2008\more\sd\list_directory\list_directory.vcproj
visual_studio_2008\more\sd\print_working_directory\print_working_directory.sln
visual_studio_2008\more\sd\print_working_directory\print_working_directory.vcproj
visual_studio_2008\more\sd\read_file\read_file.sln
visual_studio_2008\more\sd\read_file\read_file.vcproj
visual_studio_2008\more\spi\spi\spi.sln
visual_studio_2008\more\spi\spi\spi.vcproj
visual_studio_2008\more\stream\stream_basic\stream_basic.sln
visual_studio_2008\more\stream\stream_basic\stream_basic.vcproj
visual_studio_2008\more\stream\stream_basic_with_stream_out\stream_basic_with_stream_out.sln
visual_studio_2008\more\stream\stream_basic_with_stream_out\stream_basic_with_stream_out.vcproj
visual_studio_2008\more\stream\stream_burst\stream_burst.sln
visual_studio_2008\more\stream\stream_burst\stream_burst.vcproj
visual_studio_2008\more\stream\stream_callback\stream_callback.sln
visual_studio_2008\more\stream\stream_callback\stream_callback.vcproj
visual_studio_2008\more\stream\stream_external_clock\stream_external_clock.sln
visual_studio_2008\more\stream\stream_external_clock\stream_external_clock.vcproj
visual_studio_2008\more\stream\stream_out_only\stream_out_only.sln
visual_studio_2008\more\stream\stream_out_only\stream_out_only.vcproj
visual_studio_2008\more\stream\stream_out_update\stream_out_update.sln
visual_studio_2008\more\stream\stream_out_update\stream_out_update.vcproj
visual_studio_2008\more\stream\stream_sequential_ain\stream_sequential_ain.sln
visual_studio_2008\more\stream\stream_sequential_ain\stream_sequential_ain.vcproj
visual_studio_2008\more\stream\stream_triggered\stream_triggered.sln
visual_studio_2008\more\stream\stream_triggered\stream_triggered.vcproj
visual_studio_2008\more\testing\auto_reconnect_test\auto_reconnect_test.sln
visual_studio_2008\more\testing\auto_reconnect_test\auto_reconnect_test.vcproj
visual_studio_2008\more\testing\c-r_speed_test\c-r_speed_test.sln
visual_studio_2008\more\testing\c-r_speed_test\c-r_speed_test.vcproj
visual_studio_2008\more\testing\externally_clocked_stream_test\externally_clocked_stream_test.sln
visual_studio_2008\more\testing\externally_clocked_stream_test\externally_clocked_stream_test.vcproj
visual_studio_2008\more\testing\stream_burst_test\stream_burst_test.sln
visual_studio_2008\more\testing\stream_burst_test\stream_burst_test.vcproj
visual_studio_2008\more\testing\system_reboot_test\system_reboot_test.sln
visual_studio_2008\more\testing\system_reboot_test\system_reboot_test.vcproj
visual_studio_2008\more\testing\write_read_loop_with_config_speed_test_eNames\write_read_loop_with_config_speed_test_eNames.sln
visual_studio_2008\more\testing\write_read_loop_with_config_speed_test_eNames\write_read_loop_with_config_speed_test_eNames.vcproj
visual_studio_2008\more\utilities\device_info\device_info.sln
visual_studio_2008\more\utilities\device_info\device_info.vcproj
visual_studio_2008\more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking\windows_dynamic_runtime_linking.sln
visual_studio_2008\more\utilities\dynamic_runtime_linking\windows_dynamic_runtime_linking\windows_dynamic_runtime_linking.vcproj
visual_studio_2008\more\utilities\error\error.sln
visual_studio_2008\more\utilities\error\error.vcproj
visual_studio_2008\more\utilities\lua_script_basic\lua_script_basic.sln
visual_studio_2008\more\utilities\lua_script_basic\lua_script_basic.vcproj
visual_studio_2008\more\utilities\names_to_addresses\names_to_addresses.sln
visual_studio_2008\more\utilities\names_to_addresses\names_to_addresses.vcproj
visual_studio_2008\more\utilities\raw_bytes\raw_bytes.sln
visual_studio_2008\more\utilities\raw_bytes\raw_bytes.vcproj
visual_studio_2008\more\utilities\read_cal\read_cal.sln
visual_studio_2008\more\utilities\read_cal\read_cal.vcproj
visual_studio_2008\more\utilities\read_ljm_config\read_ljm_config.sln
visual_studio_2008\more\utilities\read_ljm_config\read_ljm_config.vcproj
visual_studio_2008\more\utilities\set_timeout\set_timeout.sln
visual_studio_2008\more\utilities\set_timeout\set_timeout.vcproj
visual_studio_2008\more\utilities\stepwise_feedback\stepwise_feedback.sln
visual_studio_2008\more\utilities\stepwise_feedback\stepwise_feedback.vcproj
visual_studio_2008\more\utilities\t7_tcp_configure\t7_tcp_configure.sln
visual_studio_2008\more\utilities\t7_tcp_configure\t7_tcp_configure.vcproj
visual_studio_2008\more\utilities\thermocouple_example\thermocouple_example.sln
visual_studio_2008\more\utilities\thermocouple_example\thermocouple_example.vcproj
visual_studio_2008\more\watchdog\read_watchdog_config\read_watchdog_config.sln
visual_studio_2008\more\watchdog\read_watchdog_config\read_watchdog_config.vcproj
visual_studio_2008\more\watchdog\write_watchdog_config\write_watchdog_config.sln
visual_studio_2008\more\watchdog\write_watchdog_config\write_watchdog_config.vcproj
visual_studio_2008\more\wifi\read_wifi_config\read_wifi_config.sln
visual_studio_2008\more\wifi\read_wifi_config\read_wifi_config.vcproj
visual_studio_2008\more\wifi\read_wifi_mac\read_wifi_mac.sln
visual_studio_2008\more\wifi\read_wifi_mac\read_wifi_mac.vcproj
visual_studio_2008\more\wifi\read_wifi_rssi\read_wifi_rssi.sln
visual_studio_2008\more\wifi\read_wifi_rssi\read_wifi_rssi.vcproj
visual_studio_2008\more\wifi\write_wifi_config\write_wifi_config.sln
visual_studio_2008\more\wifi\write_wifi_config\write_wifi_config.vcproj
xcode\basic\write_read_loop_with_config\write_read_loop_with_config.xcodeproj
xcode\basic\write_read_loop_with_config\write_read_loop_with_config.xcodeproj\project.pbxproj
The package below contains headers and a basic example for dynamic runtime linking with LJM.
Any examples in the C/C++ example download can be quickly modified to work with dynamic runtime linking by following the steps below:
1. Add an include for LabJackM_Dynamic.h
2. Remove include for LJM_Utilities.h
2a. Remove include for LJM_StreamUtilities.h (if applicable)
3. Add include for LJM_Utilities_Dynamic.h
3a. Add include for LJM_StreamUtilities_Dynamic.h (if applicable)
4. Add a call to the LoadLabJackM function
5. Add "p" in front of all LJM function names
If compiling as C code, use the C99 (or gnu90) standard or later
Linux and macOS need to link against libdl. A typical, basic C example build could look like:
gcc -g -Wall foo.c -ldl -o foo
DAQFactory is measurement and automation software from AzeoTech. It allows you to make a custom application with little or no programming. DAQFactory Express is a free version with the key limitation of up to 8 channels.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
The following image shows a typical view of DAQFactory with the LJM_Basic.ctl example open. We have the Workspace window on the right, the Command / Alert window at the bottom so we can readily see any error messages, and in the main area we are looking at Page_0:
A "Page" in DAQFactory is where you make your virtual front panel by adding controls, indicators, buttons, graphs, and more.
DAQFactory takes care of opening in the background, based on the D# (device number) specified in the Channels list or any LJM library calls in script. DAQFactory makes a call to LJM_OpenS, where ANY is passed to both DeviceType and ConnectionType, and the specified D# string is passed to Identifier. A D# that is blank, 0, or ANY, tells LJM to open the first device it can find. D# can also be set to serial number, IP address, or device name.
Creating a customized DAQ program is a simple process when using DAQFactory. The following image shows a view of the LJM_Basic.ctl example. By clicking Local=>CHANNELS in the Workspace window we get the Channel Table View as shown here:
Use this Channel Table VIEW to define DAQFactory Channels which are usually linked to register names on the LabJack.
The most common registers (tagged "CORE"), are listed as I/O Type options in DAQFactory, but you can link to any register by using the I/O Type "Special" and putting the register name in the Quick Note / Special column. See the LJM_Basic.ctl example.
Once you have defined a channel, you can click on the particular channel name in the Workspace under Local=>CHANNELS=> and get a detailed tab view for a particular channel, as shown in the following with the Table tab for AIN0 active:
This Table tab and the Graph tab are a quick way to see value updates for a DAQFactory Channel.
DAQFactory supports a native scripting language that can make calls to functions from the LJM library. At this time the functions LJM_eReadName and LJM_eWriteName are supported (and stream functions). Script can be put various places in DAQFactory, but the most common place is in a Sequence. The following view from LJM_Basic.ctl shows a Sequence called StartUp that has been set to Auto-Start, meaning that it will run when this ctl first loads. This sequence is making calls to LJM_eWriteName to configure the range of AIN0-AIN3.
Note from the LJM documentation links above that the first parameter to eReadName and eWriteName is normally Handle, but since DAQFactory takes care of opening in the background (see "Opening a Device" above), the first parameter in DAQFactory is actually the Identifier parameter of LJM_OpenS.
As opposed to the normal command-response mode, stream mode is used for the highest data rates. To stream with DAQFactory and the LJM library, you use script to make the calls to start the stream, read stream data, and append stream data to DAQFactory Channels. See the attached example "LJM_Stream.ctl".
Device configuration is done by writing various registers. There are 2 fundamental ways to do this:
Method #1 is quick & easy, but each device you use with this program has to be pre-configured properly.
Method #2 is a little more effort, but has the advantage that any suitable device will work with your program without requiring pre-configuration.
Within method #2, there are 2 basic ways to do the configuration within DAQFactory:
2A: The technique demonstrated in the LJM_Basic.ctl example uses an LJM function call in script to write the desired values to the proper registers. In the example, the script named "StartUp" is set to Auto-Start so that it runs when the program is first loaded and does the configuration at that time.
2B: The other technique is to define DAQFactory Channels for the proper registers and then use normal DAQFactory techniques (which might be a script) to write values to those DAQFactory Channels.
Refer to the DAQFactory help for more information. To access DAQFactory's help for LabJackM devices, select the Help -> Help Topics, then select Devices -> LabJack M (T7).
The AzeoTech forum is a great resource for DAQFactory related questions & answers.
You can also refer to Sections 4-7 of the DAQFactory - LabJackUD Application guide. Sections 1-3 and 8-11 are mostly specific to the UD library (U3/U6/UE9), but Sections 4-7 mostly apply to DAQFactory in general:
Windows Delphi wrapper and examples for the LJM library.
Refer to the download's README.txt file for requirements, usage, documentation and other details.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
program ReadSerialNumber; {$APPTYPE CONSOLE} uses SysUtils, { The following are available in the Delphi examples download. } LJMDelphi in 'Wrapper\LJMDelphi.pas', LJMUtilities in 'Examples\LJMUtilities.pas'; { Provides ErrorHandler. } const name: PAnsiChar = 'SERIAL_NUMBER'; var handle: Integer; error: Integer = 0; value: Double = 0.0; begin { Open first found LabJack. } error := LJM_OpenS('Any', 'Any', 'Any', handle); ErrorHandler('LJM_Open', error); { Call LJM_eReadName to read the serial number from the LabJack. } error := LJM_eReadName(handle, name, value); ErrorHandler('LJM_eReadName', error); Writeln('LJM_eReadName result:'); Writeln(' ' + name + ' = ' + FloatToStr(value)); end.
Delphi_LJM_2017_12_04.zip contains:
Delphi_LJM_2017_12_04\LICENSE.txt Delphi_LJM_2017_12_04\README.txt Delphi_LJM_2017_12_04\Examples\LJMUtilities.pas Delphi_LJM_2017_12_04\Examples\Basic\eAddresses.dpr Delphi_LJM_2017_12_04\Examples\Basic\eNames.dpr Delphi_LJM_2017_12_04\Examples\Basic\eReadAddress.dpr Delphi_LJM_2017_12_04\Examples\Basic\eReadAddresses.dpr Delphi_LJM_2017_12_04\Examples\Basic\eReadName.dpr Delphi_LJM_2017_12_04\Examples\Basic\eReadNames.dpr Delphi_LJM_2017_12_04\Examples\Basic\eWriteAddress.dpr Delphi_LJM_2017_12_04\Examples\Basic\eWriteAddresses.dpr Delphi_LJM_2017_12_04\Examples\Basic\eWriteName.dpr Delphi_LJM_2017_12_04\Examples\Basic\eWriteNames.dpr Delphi_LJM_2017_12_04\Examples\More\AIN\DualAINLoop.dpr Delphi_LJM_2017_12_04\Examples\More\AIN\SingleAIN.dpr Delphi_LJM_2017_12_04\Examples\More\AIN\SingleAINWithConfig.dpr Delphi_LJM_2017_12_04\Examples\More\Config\ReadConfig.dpr Delphi_LJM_2017_12_04\Examples\More\Config\ReadDeviceNameString.dpr Delphi_LJM_2017_12_04\Examples\More\Config\WriteDeviceNameString.dpr Delphi_LJM_2017_12_04\Examples\More\Config\WritePowerConfig.dpr Delphi_LJM_2017_12_04\Examples\More\DIO\SingleDIORead.dpr Delphi_LJM_2017_12_04\Examples\More\DIO\SingleDIOWrite.dpr Delphi_LJM_2017_12_04\Examples\More\Ethernet\ReadEthernetConfig.dpr Delphi_LJM_2017_12_04\Examples\More\Ethernet\ReadEthernetMAC.dpr Delphi_LJM_2017_12_04\Examples\More\Ethernet\WriteEthernetConfig.dpr Delphi_LJM_2017_12_04\Examples\More\I2C\I2CEeprom.dpr Delphi_LJM_2017_12_04\Examples\More\ListAll\ListAll.dpr Delphi_LJM_2017_12_04\Examples\More\SPI\SPI.dpr Delphi_LJM_2017_12_04\Examples\More\Stream\StreamBasic.dpr Delphi_LJM_2017_12_04\Examples\More\Stream\StreamBasicWithStreamOut.dpr Delphi_LJM_2017_12_04\Examples\More\Stream\StreamBurst.dpr Delphi_LJM_2017_12_04\Examples\More\Stream\StreamSequentialAIN.dpr Delphi_LJM_2017_12_04\Examples\More\Testing\CRSpeedTest.dpr Delphi_LJM_2017_12_04\Examples\More\Watchdog\ReadWatchdogConfig.dpr Delphi_LJM_2017_12_04\Examples\More\Watchdog\WriteWatchdogConfig.dpr Delphi_LJM_2017_12_04\Examples\More\WiFi\ReadWiFiConfig.dpr Delphi_LJM_2017_12_04\Examples\More\WiFi\ReadWiFiMAC.dpr Delphi_LJM_2017_12_04\Examples\More\WiFi\ReadWiFiRSSI.dpr Delphi_LJM_2017_12_04\Examples\More\WiFi\WriteWiFiConfig.dpr Delphi_LJM_2017_12_04\Wrapper\LJMDelphi.pas
The LJM library is the high level code library for T-Series devices. LabVIEW is one of the most popular programming languages used by our customers. LabVIEW is a graphical programming language, as demonstrated in the code snippet below, but understand that it is still a powerful programming language not a simple software tool.
http://www.ni.com/gettingstarted/labviewbasics/
Note that using a LabJack in LabVIEW is not identical to using NI hardware in LabVIEW. The NI hardware is talked to through the NI-DAQ driver, while the T7 or T4 is talked to through the LabJack LJM library. That means that you will not use measurement & automation explorer, DAQ assistant, or similar NI wizards.
LabVIEW example VIs for the LJM library.
Compatible with LabVIEW 7.1 or higher.
Includes new examples and wrapper functionality for stream out functions that are currently part of the beta version of LJM(1.21) and our logger source with new config file options.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. The following examples in the Basic folder are a great place to start:
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Stream mode and other operations that don't fit in "Write Read Loop with Config" will usually have specific examples, and if something seems to be missing let us know.
The downloadable zip file "LabVIEW_LJM.zip" extracts to a single folder called "LabVIEW_LJM" which contains a few subfolders. The folder can be stored anywhere, but if you want icons to show up on the LabVIEW function palette (after restarting LabVIEW), place this folder under ...\national instruments\labview #\vi.lib\addons\ (create the addons folder if it does not exist). Be sure the folder containing our LabVIEW functions is named "LabVIEW_LJM" when added to the LabVIEW addons folder or else the icons may not load properly. If you just see question marks, see this forum topic.
Many people, including us, do not use the palette icons but rather just copy paste from examples and use the "Select a VI..." balloon from the function palette. In that case you can put the LabVIEW_LJM folder wherever you want.
We recommend not having more than one copy of the VIs, and not changing these VIs. If you want to make your own variation of one of the examples, make a copy in a different location and modify that.
If you download new VIs from labjack.com, delete and replace the entire LabVIEW_LJM folder.
The \Functions folder contains simple VIs that do little more than call functions from LJM. Most of these need a valid Handle input so are intended to be sub-VIs not standalone top level VIs.
The \LVUtilities folder contains VIs that encapsulate some useful functions. These are used by other VIs from the \Functions\ and \Examples\ folders to handle things unique to LabVIEW.
The \Examples\Basics folder contains core examples that demonstrate the basics of interfacing LabVIEW with our LJM library. Included here is the very useful "Read Write Loop with Config.vi" example which forms the basis for most customer applications. Use the device datasheet (and/or Modbus Map) to determine what registers you need to write and read and the plug those register names into "Read Write Loop with Config.vi".
The \Examples\More folder has many more examples that demonstrate specific tasks. Some of these demonstrate unique techniques, but many are simply variations of the "Write Read Loop with Config.vi" example with different default register names and values.
The \LJLogM and \LJStreamM folders contain the source code for those sample programs. The executable versions (.exe) are part of the main LabJack software installer for Windows. Advanced LabVIEW programmers might find this source code useful, but most users are better off starting with a more basic example.
This example uses 5 calls to the LJM library:
6000 is added to the LabJack errorcodes to shift them into the LabVIEW user range of 5000-9999. For example, if the open call cannot find the device you requested it will return LabVIEW-LJM errorcode 7227, which is LabJack-LJM errorcode 1227. Many errorcodes are listed in Section 4 of the LJM User's Guide, but no need to look there for the basic string as every LabVIEW program should use LJM_ErrorToString.vi to convert the errorcode to a readable string.
All sub-VIs, which means everything in the Functions and LVUtilities folders, are set to reentrant execution. In older versions of LabVIEW, debugging is not allowed when reentrant is enabled, so debugging is disabled in all sub-VIs.
To allow debugging in sub-VIs in older LabVIEW, you will have to disable reentrent execution. Go to File => VI Properties, set Category = Execution, un-check Reentrant execution, and check Allow debugging. In newer versions of LabVIEW, you can enable debugging with reentrant enabled.
**Note**: 2 substantial changes were made to the LabVIEW_LJM archive with the 2015_01_23 release:
1. In LJM function call VIs that have the NumFrames parameter, that parameter is now optional with a default value of -1 which means "Auto-Detect the Number of Frames". If you do not wire anything to NumFrames, or pass -1, this signals the VI to use the size of aNames or aAddresses to determine the number of frames. This should not break any code using previous versions of these VIs.
2. A few changes were made to the inputs & outputs of LJM_eStreamStart.vi, and these changes will break code using a previous version of this VI. See the front panel of LJM_eStreamStart.vi for more details.
For version history, see our Github repository.
The LabVIEW NXG LJM download on this page includes some basic LJM library functionality for LabVIEW NXG.
The LJStreamM download on this page contains a small fix for LJStreamM v1.06; There was a minor bug in LJM installer release "LabJack-2019-05-20" where selecting "write to file" before the first attempt to start stream could result in an error when attempting to write data to file.
C# and Visual Basic .NET examples for the LJM library.
Refer to the download's README.txt file for more details.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. The following examples in the Basic folder are a great place to start:
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Stream mode and other operations that don't fit in "Write Read Loop with Config" will usually have specific examples, and if something seems to be missing let us know.
using System; using LabJack; namespace ReadSerialNumber { class ReadSerialNumber { static void Main(string[] args) { int handle = 0; try { //Open first found LabJack. LJM.OpenS("ANY", "ANY", "ANY", ref handle); //Call eReadName to read the serial number from the LabJack. string name = "SERIAL_NUMBER"; double value = 0; LJM.eReadName(handle, name, ref value); Console.WriteLine("eReadName result: "); Console.WriteLine(" " + name + " = " + value); } catch (LJM.LJMException e) { Console.Out.WriteLine("Error: " + e.ToString()); } } } }
Imports LabJack Module ReadSerialNumber Sub Main() Dim handle As Integer Dim name As String Dim value As Double = 0 Try ' Open first found LabJack. LJM.OpenS("ANY", "ANY", "ANY", handle) ' Call eReadName to read the serial number from the LabJack. name = "SERIAL_NUMBER" LJM.eReadName(handle, name, value) Console.WriteLine("eReadName result: ") Console.WriteLine(" " & name & " = " & value) Catch ljme As LJM.LJMException Console.WriteLine("Error: " & ljme.ToString) End Try End Sub End Module
Click to expand DotNet_LJM_2018_03_14.zip contents
LICENSE.txt README.txt Examples\C#\Basic\EasyFunctions\EasyFunctions.cs Examples\C#\Basic\EasyFunctions\EasyFunctions.csproj Examples\C#\Basic\EasyFunctions\EasyFunctions.sln Examples\C#\Basic\EasyFunctions\Properties\AssemblyInfo.cs Examples\C#\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.cs Examples\C#\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.csproj Examples\C#\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.sln Examples\C#\Basic\WriteReadLoopWithConfig\Properties\AssemblyInfo.cs Examples\C#\More\AIN\DualAINLoop\DualAINLoop.cs Examples\C#\More\AIN\DualAINLoop\DualAINLoop.csproj Examples\C#\More\AIN\DualAINLoop\DualAINLoop.sln Examples\C#\More\AIN\DualAINLoop\Properties\AssemblyInfo.cs Examples\C#\More\AIN\SingleAIN\SingleAIN.cs Examples\C#\More\AIN\SingleAIN\SingleAIN.csproj Examples\C#\More\AIN\SingleAIN\SingleAIN.sln Examples\C#\More\AIN\SingleAIN\Properties\AssemblyInfo.cs Examples\C#\More\AIN\SingleAINWithConfig\SingleAINWithConfig.cs Examples\C#\More\AIN\SingleAINWithConfig\SingleAINWithConfig.csproj Examples\C#\More\AIN\SingleAINWithConfig\SingleAINWithConfig.sln Examples\C#\More\AIN\SingleAINWithConfig\Properties\AssemblyInfo.cs Examples\C#\More\Config\ReadConfig\ReadConfig.cs Examples\C#\More\Config\ReadConfig\ReadConfig.csproj Examples\C#\More\Config\ReadConfig\ReadConfig.sln Examples\C#\More\Config\ReadConfig\Properties\AssemblyInfo.cs Examples\C#\More\Config\ReadDeviceNameString\ReadDeviceNameString.cs Examples\C#\More\Config\ReadDeviceNameString\ReadDeviceNameString.csproj Examples\C#\More\Config\ReadDeviceNameString\ReadDeviceNameString.sln Examples\C#\More\Config\ReadDeviceNameString\Properties\AssemblyInfo.cs Examples\C#\More\Config\WriteDeviceNameString\WriteDeviceNameString.cs Examples\C#\More\Config\WriteDeviceNameString\WriteDeviceNameString.csproj Examples\C#\More\Config\WriteDeviceNameString\WriteDeviceNameString.sln Examples\C#\More\Config\WriteDeviceNameString\Properties\AssemblyInfo.cs Examples\C#\More\Config\WritePowerConfig\WritePowerConfig.cs Examples\C#\More\Config\WritePowerConfig\WritePowerConfig.csproj Examples\C#\More\Config\WritePowerConfig\WritePowerConfig.sln Examples\C#\More\Config\WritePowerConfig\Properties\AssemblyInfo.cs Examples\C#\More\DIO\SingleDIO\SingleDIO.cs Examples\C#\More\DIO\SingleDIO\SingleDIO.csproj Examples\C#\More\DIO\SingleDIO\SingleDIO.sln Examples\C#\More\DIO\SingleDIO\Properties\AssemblyInfo.cs Examples\C#\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.cs Examples\C#\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.csproj Examples\C#\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.sln Examples\C#\More\Ethernet\ReadEthernetConfig\Properties\AssemblyInfo.cs Examples\C#\More\Ethernet\ReadEthernetMac\ReadEthernetMac.cs Examples\C#\More\Ethernet\ReadEthernetMac\ReadEthernetMac.csproj Examples\C#\More\Ethernet\ReadEthernetMac\ReadEthernetMac.sln Examples\C#\More\Ethernet\ReadEthernetMac\Properties\AssemblyInfo.cs Examples\C#\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.cs Examples\C#\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.csproj Examples\C#\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.sln Examples\C#\More\Ethernet\WriteEthernetConfig\Properties\AssemblyInfo.cs Examples\C#\More\I2C\I2CEeprom\I2CEeprom.cs Examples\C#\More\I2C\I2CEeprom\I2CEeprom.csproj Examples\C#\More\I2C\I2CEeprom\I2CEeprom.sln Examples\C#\More\I2C\I2CEeprom\Properties\AssemblyInfo.cs Examples\C#\More\ListAll\ListAll.cs Examples\C#\More\ListAll\ListAll.csproj Examples\C#\More\ListAll\ListAll.sln Examples\C#\More\ListAll\Properties\AssemblyInfo.cs Examples\C#\More\SPI\SPI\SPI.cs Examples\C#\More\SPI\SPI\SPI.csproj Examples\C#\More\SPI\SPI\SPI.sln Examples\C#\More\SPI\SPI\Properties\AssemblyInfo.cs Examples\C#\More\Stream\StreamBasic\StreamBasic.cs Examples\C#\More\Stream\StreamBasic\StreamBasic.csproj Examples\C#\More\Stream\StreamBasic\StreamBasic.sln Examples\C#\More\Stream\StreamBasic\Properties\AssemblyInfo.cs Examples\C#\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.cs Examples\C#\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.csproj Examples\C#\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.sln Examples\C#\More\Stream\StreamBasicWithStreamOut\Properties\AssemblyInfo.cs Examples\C#\More\Stream\StreamBurst\StreamBurst.cs Examples\C#\More\Stream\StreamBurst\StreamBurst.csproj Examples\C#\More\Stream\StreamBurst\StreamBurst.sln Examples\C#\More\Stream\StreamBurst\Properties\AssemblyInfo.cs Examples\C#\More\Stream\StreamSequentialAIN\StreamSequentialAIN.cs Examples\C#\More\Stream\StreamSequentialAIN\StreamSequentialAIN.csproj Examples\C#\More\Stream\StreamSequentialAIN\StreamSequentialAIN.sln Examples\C#\More\Stream\StreamSequentialAIN\Properties\AssemblyInfo.cs Examples\C#\More\Testing\CRSpeedTest\CRSpeedTest.cs Examples\C#\More\Testing\CRSpeedTest\CRSpeedTest.csproj Examples\C#\More\Testing\CRSpeedTest\CRSpeedTest.sln Examples\C#\More\Testing\CRSpeedTest\Properties\AssemblyInfo.cs Examples\C#\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.cs Examples\C#\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.csproj Examples\C#\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.sln Examples\C#\More\Watchdog\ReadWatchdogConfig\Properties\AssemblyInfo.cs Examples\C#\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.cs Examples\C#\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.csproj Examples\C#\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.sln Examples\C#\More\Watchdog\WriteWatchdogConfig\Properties\AssemblyInfo.cs Examples\C#\More\WiFi\ReadWifiConfig\ReadWifiConfig.cs Examples\C#\More\WiFi\ReadWifiConfig\ReadWifiConfig.csproj Examples\C#\More\WiFi\ReadWifiConfig\ReadWifiConfig.sln Examples\C#\More\WiFi\ReadWifiConfig\Properties\AssemblyInfo.cs Examples\C#\More\WiFi\ReadWifiMac\ReadWifiMac.cs Examples\C#\More\WiFi\ReadWifiMac\ReadWifiMac.csproj Examples\C#\More\WiFi\ReadWifiMac\ReadWifiMac.sln Examples\C#\More\WiFi\ReadWifiMac\Properties\AssemblyInfo.cs Examples\C#\More\WiFi\ReadWifiRssi\ReadWifiRssi.cs Examples\C#\More\WiFi\ReadWifiRssi\ReadWifiRssi.csproj Examples\C#\More\WiFi\ReadWifiRssi\ReadWifiRssi.sln Examples\C#\More\WiFi\ReadWifiRssi\Properties\AssemblyInfo.cs Examples\C#\More\WiFi\WriteWifiConfig\WriteWifiConfig.cs Examples\C#\More\WiFi\WriteWifiConfig\WriteWifiConfig.csproj Examples\C#\More\WiFi\WriteWifiConfig\WriteWifiConfig.sln Examples\C#\More\WiFi\WriteWifiConfig\Properties\AssemblyInfo.cs Examples\VB\LJMUtilities.vb Examples\VB\Basic\EasyFunctions\EasyFunctions.sln Examples\VB\Basic\EasyFunctions\EasyFunctions.vb Examples\VB\Basic\EasyFunctions\EasyFunctions.vbproj Examples\VB\Basic\EasyFunctions\My Project\Application.Designer.vb Examples\VB\Basic\EasyFunctions\My Project\Application.myapp Examples\VB\Basic\EasyFunctions\My Project\AssemblyInfo.vb Examples\VB\Basic\EasyFunctions\My Project\Resources.Designer.vb Examples\VB\Basic\EasyFunctions\My Project\Resources.resx Examples\VB\Basic\EasyFunctions\My Project\Settings.Designer.vb Examples\VB\Basic\EasyFunctions\My Project\Settings.settings Examples\VB\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.sln Examples\VB\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.vb Examples\VB\Basic\WriteReadLoopWithConfig\WriteReadLoopWithConfig.vbproj Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Application.Designer.vb Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Application.myapp Examples\VB\Basic\WriteReadLoopWithConfig\My Project\AssemblyInfo.vb Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Resources.Designer.vb Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Resources.resx Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Settings.Designer.vb Examples\VB\Basic\WriteReadLoopWithConfig\My Project\Settings.settings Examples\VB\More\AIN\DualAINLoop\DualAINLoop.sln Examples\VB\More\AIN\DualAINLoop\DualAINLoop.vb Examples\VB\More\AIN\DualAINLoop\DualAINLoop.vbproj Examples\VB\More\AIN\DualAINLoop\My Project\Application.Designer.vb Examples\VB\More\AIN\DualAINLoop\My Project\Application.myapp Examples\VB\More\AIN\DualAINLoop\My Project\AssemblyInfo.vb Examples\VB\More\AIN\DualAINLoop\My Project\Resources.Designer.vb Examples\VB\More\AIN\DualAINLoop\My Project\Resources.resx Examples\VB\More\AIN\DualAINLoop\My Project\Settings.Designer.vb Examples\VB\More\AIN\DualAINLoop\My Project\Settings.settings Examples\VB\More\AIN\SingleAIN\SingleAIN.sln Examples\VB\More\AIN\SingleAIN\SingleAIN.vb Examples\VB\More\AIN\SingleAIN\SingleAIN.vbproj Examples\VB\More\AIN\SingleAIN\My Project\Application.Designer.vb Examples\VB\More\AIN\SingleAIN\My Project\Application.myapp Examples\VB\More\AIN\SingleAIN\My Project\AssemblyInfo.vb Examples\VB\More\AIN\SingleAIN\My Project\Resources.Designer.vb Examples\VB\More\AIN\SingleAIN\My Project\Resources.resx Examples\VB\More\AIN\SingleAIN\My Project\Settings.Designer.vb Examples\VB\More\AIN\SingleAIN\My Project\Settings.settings Examples\VB\More\AIN\SingleAINWithConfig\SingleAINWithConfig.sln Examples\VB\More\AIN\SingleAINWithConfig\SingleAINWithConfig.vb Examples\VB\More\AIN\SingleAINWithConfig\SingleAINWithConfig.vbproj Examples\VB\More\AIN\SingleAINWithConfig\My Project\Application.Designer.vb Examples\VB\More\AIN\SingleAINWithConfig\My Project\Application.myapp Examples\VB\More\AIN\SingleAINWithConfig\My Project\AssemblyInfo.vb Examples\VB\More\AIN\SingleAINWithConfig\My Project\Resources.Designer.vb Examples\VB\More\AIN\SingleAINWithConfig\My Project\Resources.resx Examples\VB\More\AIN\SingleAINWithConfig\My Project\Settings.Designer.vb Examples\VB\More\AIN\SingleAINWithConfig\My Project\Settings.settings Examples\VB\More\Config\ReadConfig\ReadConfig.sln Examples\VB\More\Config\ReadConfig\ReadConfig.vb Examples\VB\More\Config\ReadConfig\ReadConfig.vbproj Examples\VB\More\Config\ReadConfig\My Project\Application.Designer.vb Examples\VB\More\Config\ReadConfig\My Project\Application.myapp Examples\VB\More\Config\ReadConfig\My Project\AssemblyInfo.vb Examples\VB\More\Config\ReadConfig\My Project\Resources.Designer.vb Examples\VB\More\Config\ReadConfig\My Project\Resources.resx Examples\VB\More\Config\ReadConfig\My Project\Settings.Designer.vb Examples\VB\More\Config\ReadConfig\My Project\Settings.settings Examples\VB\More\Config\ReadDeviceNameString\ReadDeviceNameString.sln Examples\VB\More\Config\ReadDeviceNameString\ReadDeviceNameString.vb Examples\VB\More\Config\ReadDeviceNameString\ReadDeviceNameString.vbproj Examples\VB\More\Config\ReadDeviceNameString\My Project\Application.Designer.vb Examples\VB\More\Config\ReadDeviceNameString\My Project\Application.myapp Examples\VB\More\Config\ReadDeviceNameString\My Project\AssemblyInfo.vb Examples\VB\More\Config\ReadDeviceNameString\My Project\Resources.Designer.vb Examples\VB\More\Config\ReadDeviceNameString\My Project\Resources.resx Examples\VB\More\Config\ReadDeviceNameString\My Project\Settings.Designer.vb Examples\VB\More\Config\ReadDeviceNameString\My Project\Settings.settings Examples\VB\More\Config\WriteDeviceNameString\WriteDeviceNameString.sln Examples\VB\More\Config\WriteDeviceNameString\WriteDeviceNameString.vb Examples\VB\More\Config\WriteDeviceNameString\WriteDeviceNameString.vbproj Examples\VB\More\Config\WriteDeviceNameString\My Project\Application.Designer.vb Examples\VB\More\Config\WriteDeviceNameString\My Project\Application.myapp Examples\VB\More\Config\WriteDeviceNameString\My Project\AssemblyInfo.vb Examples\VB\More\Config\WriteDeviceNameString\My Project\Resources.Designer.vb Examples\VB\More\Config\WriteDeviceNameString\My Project\Resources.resx Examples\VB\More\Config\WriteDeviceNameString\My Project\Settings.Designer.vb Examples\VB\More\Config\WriteDeviceNameString\My Project\Settings.settings Examples\VB\More\Config\WritePowerConfig\WritePowerConfig.sln Examples\VB\More\Config\WritePowerConfig\WritePowerConfig.vb Examples\VB\More\Config\WritePowerConfig\WritePowerConfig.vbproj Examples\VB\More\Config\WritePowerConfig\My Project\Application.Designer.vb Examples\VB\More\Config\WritePowerConfig\My Project\Application.myapp Examples\VB\More\Config\WritePowerConfig\My Project\AssemblyInfo.vb Examples\VB\More\Config\WritePowerConfig\My Project\Resources.Designer.vb Examples\VB\More\Config\WritePowerConfig\My Project\Resources.resx Examples\VB\More\Config\WritePowerConfig\My Project\Settings.Designer.vb Examples\VB\More\Config\WritePowerConfig\My Project\Settings.settings Examples\VB\More\DIO\SingleDIO\SingleDIO.sln Examples\VB\More\DIO\SingleDIO\SingleDIO.vb Examples\VB\More\DIO\SingleDIO\SingleDIO.vbproj Examples\VB\More\DIO\SingleDIO\My Project\Application.Designer.vb Examples\VB\More\DIO\SingleDIO\My Project\Application.myapp Examples\VB\More\DIO\SingleDIO\My Project\AssemblyInfo.vb Examples\VB\More\DIO\SingleDIO\My Project\Resources.Designer.vb Examples\VB\More\DIO\SingleDIO\My Project\Resources.resx Examples\VB\More\DIO\SingleDIO\My Project\Settings.Designer.vb Examples\VB\More\DIO\SingleDIO\My Project\Settings.settings Examples\VB\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.sln Examples\VB\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.vb Examples\VB\More\Ethernet\ReadEthernetConfig\ReadEthernetConfig.vbproj Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Application.Designer.vb Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Application.myapp Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\AssemblyInfo.vb Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Resources.Designer.vb Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Resources.resx Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Settings.Designer.vb Examples\VB\More\Ethernet\ReadEthernetConfig\My Project\Settings.settings Examples\VB\More\Ethernet\ReadEthernetMac\ReadEthernetMac.sln Examples\VB\More\Ethernet\ReadEthernetMac\ReadEthernetMac.vb Examples\VB\More\Ethernet\ReadEthernetMac\ReadEthernetMac.vbproj Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Application.Designer.vb Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Application.myapp Examples\VB\More\Ethernet\ReadEthernetMac\My Project\AssemblyInfo.vb Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Resources.Designer.vb Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Resources.resx Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Settings.Designer.vb Examples\VB\More\Ethernet\ReadEthernetMac\My Project\Settings.settings Examples\VB\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.sln Examples\VB\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.vb Examples\VB\More\Ethernet\WriteEthernetConfig\WriteEthernetConfig.vbproj Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Application.Designer.vb Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Application.myapp Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\AssemblyInfo.vb Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Resources.Designer.vb Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Resources.resx Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Settings.Designer.vb Examples\VB\More\Ethernet\WriteEthernetConfig\My Project\Settings.settings Examples\VB\More\I2C\I2CEeprom\I2CEeprom.sln Examples\VB\More\I2C\I2CEeprom\I2CEeprom.vb Examples\VB\More\I2C\I2CEeprom\I2CEeprom.vbproj Examples\VB\More\I2C\I2CEeprom\My Project\Application.Designer.vb Examples\VB\More\I2C\I2CEeprom\My Project\Application.myapp Examples\VB\More\I2C\I2CEeprom\My Project\AssemblyInfo.vb Examples\VB\More\I2C\I2CEeprom\My Project\Resources.Designer.vb Examples\VB\More\I2C\I2CEeprom\My Project\Resources.resx Examples\VB\More\I2C\I2CEeprom\My Project\Settings.Designer.vb Examples\VB\More\I2C\I2CEeprom\My Project\Settings.settings Examples\VB\More\ListAll\ListAll.sln Examples\VB\More\ListAll\ListAll.vb Examples\VB\More\ListAll\ListAll.vbproj Examples\VB\More\ListAll\My Project\Application.Designer.vb Examples\VB\More\ListAll\My Project\Application.myapp Examples\VB\More\ListAll\My Project\AssemblyInfo.vb Examples\VB\More\ListAll\My Project\Resources.Designer.vb Examples\VB\More\ListAll\My Project\Resources.resx Examples\VB\More\ListAll\My Project\Settings.Designer.vb Examples\VB\More\ListAll\My Project\Settings.settings Examples\VB\More\SPI\SPI\SPI.sln Examples\VB\More\SPI\SPI\SPI.vb Examples\VB\More\SPI\SPI\SPI.vbproj Examples\VB\More\SPI\SPI\My Project\Application.Designer.vb Examples\VB\More\SPI\SPI\My Project\Application.myapp Examples\VB\More\SPI\SPI\My Project\AssemblyInfo.vb Examples\VB\More\SPI\SPI\My Project\Resources.Designer.vb Examples\VB\More\SPI\SPI\My Project\Resources.resx Examples\VB\More\SPI\SPI\My Project\Settings.Designer.vb Examples\VB\More\SPI\SPI\My Project\Settings.settings Examples\VB\More\Stream\StreamBasic\StreamBasic.sln Examples\VB\More\Stream\StreamBasic\StreamBasic.vb Examples\VB\More\Stream\StreamBasic\StreamBasic.vbproj Examples\VB\More\Stream\StreamBasic\My Project\Application.Designer.vb Examples\VB\More\Stream\StreamBasic\My Project\Application.myapp Examples\VB\More\Stream\StreamBasic\My Project\AssemblyInfo.vb Examples\VB\More\Stream\StreamBasic\My Project\Resources.Designer.vb Examples\VB\More\Stream\StreamBasic\My Project\Resources.resx Examples\VB\More\Stream\StreamBasic\My Project\Settings.Designer.vb Examples\VB\More\Stream\StreamBasic\My Project\Settings.settings Examples\VB\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.sln Examples\VB\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.vb Examples\VB\More\Stream\StreamBasicWithStreamOut\StreamBasicWithStreamOut.vbproj Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Application.Designer.vb Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Application.myapp Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\AssemblyInfo.vb Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Resources.Designer.vb Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Resources.resx Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Settings.Designer.vb Examples\VB\More\Stream\StreamBasicWithStreamOut\My Project\Settings.settings Examples\VB\More\Stream\StreamBurst\StreamBurst.sln Examples\VB\More\Stream\StreamBurst\StreamBurst.vb Examples\VB\More\Stream\StreamBurst\StreamBurst.vbproj Examples\VB\More\Stream\StreamBurst\My Project\Application.Designer.vb Examples\VB\More\Stream\StreamBurst\My Project\Application.myapp Examples\VB\More\Stream\StreamBurst\My Project\AssemblyInfo.vb Examples\VB\More\Stream\StreamBurst\My Project\Resources.Designer.vb Examples\VB\More\Stream\StreamBurst\My Project\Resources.resx Examples\VB\More\Stream\StreamBurst\My Project\Settings.Designer.vb Examples\VB\More\Stream\StreamBurst\My Project\Settings.settings Examples\VB\More\Stream\StreamSequentialAIN\StreamSequentialAIN.sln Examples\VB\More\Stream\StreamSequentialAIN\StreamSequentialAIN.vb Examples\VB\More\Stream\StreamSequentialAIN\StreamSequentialAIN.vbproj Examples\VB\More\Stream\StreamSequentialAIN\My Project\Application.Designer.vb Examples\VB\More\Stream\StreamSequentialAIN\My Project\Application.myapp Examples\VB\More\Stream\StreamSequentialAIN\My Project\AssemblyInfo.vb Examples\VB\More\Stream\StreamSequentialAIN\My Project\Resources.Designer.vb Examples\VB\More\Stream\StreamSequentialAIN\My Project\Resources.resx Examples\VB\More\Stream\StreamSequentialAIN\My Project\Settings.Designer.vb Examples\VB\More\Stream\StreamSequentialAIN\My Project\Settings.settings Examples\VB\More\Stream\TriggeredStreamStart\TriggeredStreamStart.sln Examples\VB\More\Stream\TriggeredStreamStart\TriggeredStreamStart.vb Examples\VB\More\Stream\TriggeredStreamStart\TriggeredStreamStart.vbproj Examples\VB\More\Stream\TriggeredStreamStart\TriggeredStreamStart.vbproj.user Examples\VB\More\Stream\TriggeredStreamStart\My Project\app.manifest Examples\VB\More\Stream\TriggeredStreamStart\My Project\Application.Designer.vb Examples\VB\More\Stream\TriggeredStreamStart\My Project\Application.myapp Examples\VB\More\Stream\TriggeredStreamStart\My Project\AssemblyInfo.vb Examples\VB\More\Stream\TriggeredStreamStart\My Project\Resources.Designer.vb Examples\VB\More\Stream\TriggeredStreamStart\My Project\Resources.resx Examples\VB\More\Stream\TriggeredStreamStart\My Project\Settings.Designer.vb Examples\VB\More\Stream\TriggeredStreamStart\My Project\Settings.settings Examples\VB\More\Testing\CRSpeedTest\CRSpeedTest.sln Examples\VB\More\Testing\CRSpeedTest\CRSpeedTest.vb Examples\VB\More\Testing\CRSpeedTest\CRSpeedTest.vbproj Examples\VB\More\Testing\CRSpeedTest\My Project\Application.Designer.vb Examples\VB\More\Testing\CRSpeedTest\My Project\Application.myapp Examples\VB\More\Testing\CRSpeedTest\My Project\AssemblyInfo.vb Examples\VB\More\Testing\CRSpeedTest\My Project\Resources.Designer.vb Examples\VB\More\Testing\CRSpeedTest\My Project\Resources.resx Examples\VB\More\Testing\CRSpeedTest\My Project\Settings.Designer.vb Examples\VB\More\Testing\CRSpeedTest\My Project\Settings.settings Examples\VB\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.sln Examples\VB\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.vb Examples\VB\More\Watchdog\ReadWatchdogConfig\ReadWatchdogConfig.vbproj Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Application.Designer.vb Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Application.myapp Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\AssemblyInfo.vb Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Resources.Designer.vb Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Resources.resx Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Settings.Designer.vb Examples\VB\More\Watchdog\ReadWatchdogConfig\My Project\Settings.settings Examples\VB\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.sln Examples\VB\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.vb Examples\VB\More\Watchdog\WriteWatchdogConfig\WriteWatchdogConfig.vbproj Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Application.Designer.vb Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Application.myapp Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\AssemblyInfo.vb Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Resources.Designer.vb Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Resources.resx Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Settings.Designer.vb Examples\VB\More\Watchdog\WriteWatchdogConfig\My Project\Settings.settings Examples\VB\More\WiFi\ReadWifiConfig\ReadWifiConfig.sln Examples\VB\More\WiFi\ReadWifiConfig\ReadWifiConfig.vb Examples\VB\More\WiFi\ReadWifiConfig\ReadWifiConfig.vbproj Examples\VB\More\WiFi\ReadWifiConfig\My Project\Application.Designer.vb Examples\VB\More\WiFi\ReadWifiConfig\My Project\Application.myapp Examples\VB\More\WiFi\ReadWifiConfig\My Project\AssemblyInfo.vb Examples\VB\More\WiFi\ReadWifiConfig\My Project\Resources.Designer.vb Examples\VB\More\WiFi\ReadWifiConfig\My Project\Resources.resx Examples\VB\More\WiFi\ReadWifiConfig\My Project\Settings.Designer.vb Examples\VB\More\WiFi\ReadWifiConfig\My Project\Settings.settings Examples\VB\More\WiFi\ReadWifiMac\ReadWifiMac.sln Examples\VB\More\WiFi\ReadWifiMac\ReadWifiMac.vb Examples\VB\More\WiFi\ReadWifiMac\ReadWifiMac.vbproj Examples\VB\More\WiFi\ReadWifiMac\My Project\Application.Designer.vb Examples\VB\More\WiFi\ReadWifiMac\My Project\Application.myapp Examples\VB\More\WiFi\ReadWifiMac\My Project\AssemblyInfo.vb Examples\VB\More\WiFi\ReadWifiMac\My Project\Resources.Designer.vb Examples\VB\More\WiFi\ReadWifiMac\My Project\Resources.resx Examples\VB\More\WiFi\ReadWifiMac\My Project\Settings.Designer.vb Examples\VB\More\WiFi\ReadWifiMac\My Project\Settings.settings Examples\VB\More\WiFi\ReadWifiRssi\ReadWifiRssi.sln Examples\VB\More\WiFi\ReadWifiRssi\ReadWifiRssi.vb Examples\VB\More\WiFi\ReadWifiRssi\ReadWifiRssi.vbproj Examples\VB\More\WiFi\ReadWifiRssi\My Project\Application.Designer.vb Examples\VB\More\WiFi\ReadWifiRssi\My Project\Application.myapp Examples\VB\More\WiFi\ReadWifiRssi\My Project\AssemblyInfo.vb Examples\VB\More\WiFi\ReadWifiRssi\My Project\Resources.Designer.vb Examples\VB\More\WiFi\ReadWifiRssi\My Project\Resources.resx Examples\VB\More\WiFi\ReadWifiRssi\My Project\Settings.Designer.vb Examples\VB\More\WiFi\ReadWifiRssi\My Project\Settings.settings Examples\VB\More\WiFi\WriteWifiConfig\WriteWifiConfig.sln Examples\VB\More\WiFi\WriteWifiConfig\WriteWifiConfig.vb Examples\VB\More\WiFi\WriteWifiConfig\WriteWifiConfig.vbproj Examples\VB\More\WiFi\WriteWifiConfig\My Project\Application.Designer.vb Examples\VB\More\WiFi\WriteWifiConfig\My Project\Application.myapp Examples\VB\More\WiFi\WriteWifiConfig\My Project\AssemblyInfo.vb Examples\VB\More\WiFi\WriteWifiConfig\My Project\Resources.Designer.vb Examples\VB\More\WiFi\WriteWifiConfig\My Project\Resources.resx Examples\VB\More\WiFi\WriteWifiConfig\My Project\Settings.Designer.vb Examples\VB\More\WiFi\WriteWifiConfig\My Project\Settings.settings
Cross-platform Java wrapper and examples for the LJM library.
javac -classpath .;..;..\..\jar\jna.jar;..\..\jar\ljm.jar EReadName.java
java -classpath .;..;..\..\jar\jna.jar;..\..\jar\ljm.jar EReadName
Mac OS X/Linux
javac -classpath .:..:../../jar/jna.jar:../../jar/ljm.jar EReadName.java
java -classpath .:..:../../jar/jna.jar:../../jar/ljm.jar EReadName
Refer to the download's README.TXT file for requirements, compile/run instructions, documentation and license information.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
import java.text.DecimalFormat;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.DoubleByReference;
import com.labjack.LJM;
import com.labjack.LJMException;
public class ReadSerialNumber {
public static void main(final String[] args) {
try {
IntByReference handleRef = new IntByReference(0);
int handle = 0;
//Open first found LabJack
LJM.openS("ANY", "ANY", "ANY", handleRef);
handle = handleRef.getValue();
//Call eReadName to read the serial number from the LabJack.
String name = "SERIAL_NUMBER";
DoubleByReference valueRef = new DoubleByReference(0);
LJM.eReadName(handle, name, valueRef);
System.out.println("\neReadName result: ");
System.out.println(" " + name + " = "
+ new DecimalFormat("#.#").format( valueRef.getValue() ));
}
catch (LJMException le) {
le.printStackTrace();
}
}
}
Java_LJM_2017_12_04.zip contains:
LICENSE.txt README.txt doc\allclasses-frame.html doc\allclasses-noframe.html doc\constant-values.html doc\deprecated-list.html doc\help-doc.html doc\index-all.html doc\index.html doc\overview-tree.html doc\script.js doc\serialized-form.html doc\stylesheet.css doc\com\labjack\LJM.Constants.html doc\com\labjack\LJM.Errors.html doc\com\labjack\LJM.html doc\com\labjack\LJM.LabJackM.html doc\com\labjack\LJMException.html doc\com\labjack\package-frame.html doc\com\labjack\package-summary.html doc\com\labjack\package-tree.html examples\LJMUtilities.java examples\Basic\EAddresses.java examples\Basic\ENames.java examples\Basic\EReadAddress.java examples\Basic\EReadAddresses.java examples\Basic\EReadName.java examples\Basic\EReadNames.java examples\Basic\EWriteAddress.java examples\Basic\EWriteAddresses.java examples\Basic\EWriteName.java examples\Basic\EWriteNames.java examples\More\AIN\DualAINLoop.java examples\More\AIN\SingleAIN.java examples\More\AIN\SingleAINWithConfig.java examples\More\Config\ReadConfig.java examples\More\Config\ReadDeviceNameString.java examples\More\Config\WriteDeviceNameString.java examples\More\Config\WritePowerConfig.java examples\More\DIO\SingleDIORead.java examples\More\DIO\SingleDIOWrite.java examples\More\DIO_EF\DioEfConfig1PwmAnd1Counter.java examples\More\Ethernet\ReadEthernetConfig.java examples\More\Ethernet\ReadEthernetMac.java examples\More\Ethernet\WriteEthernetConfig.java examples\More\I2C\I2CEeprom.java examples\More\ListAll\ListAll.java examples\More\SPI\SPI.java examples\More\Stream\StreamBasic.java examples\More\Stream\StreamBasicWithStreamOut.java examples\More\Stream\StreamBurst.java examples\More\Stream\StreamSequentialAIN.java examples\More\Testing\CRSpeedTest.java examples\More\Watchdog\ReadWatchdogConfig.java examples\More\Watchdog\WriteWatchdogConfig.java examples\More\WiFi\ReadWiFiConfig.java examples\More\WiFi\ReadWiFiMac.java examples\More\WiFi\ReadWiFiRssi.java examples\More\WiFi\WriteWiFiConfig.java jar\jna.jar jar\ljm.jar src\build_ljm.bat src\Manifest.txt src\com\labjack\LJM.java src\com\labjack\LJMException.java
MATLAB .NET example scripts for the LJM library.
Note: Add example scripts to the MATLAB path before running, and all examples require the functions in showDeviceInfo.m and showErrorMessage.m.
Refer to the download's README.txt file for more details.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. The following examples in the Basic folder are a great place to start:
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Stream mode and other operations that don't fit in "Write Read Loop with Config" will usually have specific examples, and if something seems to be missing let us know.
%Make the LJM .NET assembly visible in MATLAB ljmAsm = NET.addAssembly('LabJack.LJM'); handle = 0; try %Open first found LabJack [ljmError, handle] = LabJack.LJM.OpenS('ANY', 'ANY', 'ANY', handle); %Call eReadNames to read the serial number from the LabJack. name = 'SERIAL_NUMBER'; [ljmError, value] = LabJack.LJM.eReadName(handle, name, 0); disp('eReadName result:') disp([' ' name ' = ' num2str(value)]) catch e showErrorMessage(e) end
MATLAB_LJM_2017_12_04.zip contains:
LICENSE.txt README.txt Examples\getDeviceType.m Examples\showDeviceInfo.m Examples\showErrorMessage.m Examples\Basic\eAddresses.m Examples\Basic\eNames.m Examples\Basic\eReadAddress.m Examples\Basic\eReadAddresses.m Examples\Basic\eReadName.m Examples\Basic\eReadNames.m Examples\Basic\eWriteAddress.m Examples\Basic\eWriteAddresses.m Examples\Basic\eWriteName.m Examples\Basic\eWriteNames.m Examples\More\AIN\DualAINLoop.m Examples\More\AIN\SingleAIN.m Examples\More\AIN\SingleAINWithConfig.m Examples\More\Config\ReadConfig.m Examples\More\Config\ReadDeviceNameString.m Examples\More\Config\WriteDeviceNameString.m Examples\More\Config\WritePowerConfig.m Examples\More\DIO\SingleDIORead.m Examples\More\DIO\SingleDIOWrite.m Examples\More\Ethernet\ReadEthernetConfig.m Examples\More\Ethernet\ReadEthernetMac.m Examples\More\Ethernet\WriteEthernetConfig.m Examples\More\I2C\I2CEeprom.m Examples\More\ListAll\ListAll.m Examples\More\SPI\SPI.m Examples\More\Stream\StreamBasic.m Examples\More\Stream\StreamBasicWithStreamOut.m Examples\More\Stream\StreamBurst.m Examples\More\Stream\StreamSequentialAIN.m Examples\More\Testing\CRSpeedTest.m Examples\More\Watchdog\ReadWatchdogConfig.m Examples\More\Watchdog\WriteWatchdogConfig.m Examples\More\WiFi\ReadWiFiConfig.m Examples\More\WiFi\ReadWiFiMac.m Examples\More\WiFi\ReadWiFiRssi.m Examples\More\WiFi\WriteWiFiConfig.m
You may also wish to go to the T4 or T7 Quickstart Tutorial and confirm basic operation.
Cross-platform Python wrapper and examples for the LJM library.
This package is available on GitHub: github.com/labjack/labjack-ljm-python
To run LJM using Python, both the LJM library and the labjack-ljm Python package must be installed.
labjack-ljm is typically installed using pip. To use pip, open a terminal or console window and use the following command:
python -m pip install labjack-ljm
or:
pip install labjack-ljm
Run the command with sudo on Linux and Mac.
Alternately, labjack-ljm can be installed via the .zip file. To do so, download/extract the .zip file attached at the top of this page. In a terminal or console, navigate to the extracted folder and run the following command:
python setup.py install
Run the command with sudo on Linux and Mac.
labjack-ljm examples are in the .zip file attached at the top of this page.
Refer to the download's README.TXT file for requirements, installation, installation troubleshooting, documentation, and license information.
Make sure labjack-ljm is installed for the current version of Python
Many computers have multiple installations of Python. The following error indicates that labjack-ljm is not installed for the current version of Python:
ImportError: No module named labjack
Make sure you install labjack-ljm for the Python version you are using. For example, on Linux if both Python 2.7 and 3.5 are installed, you can install labjack-ljm to Python 3.5 with:
$ python3.5 -m pip labjack-ljm install
Check the Python path
To check what the path of the Python executable is:
You can also check where python3 is, or any other version of Python. For example: where python3 or which python3
Windows - Make sure Python is installed and added to the path
Running python setup.py install may cause the following error:
'python' is not recognized as an internal or external command, operable program or batch file.
In this case, either Python is not installed on your computer or the Python executable was added to the path.
To resolve this, run the Python Windows installer. As shown below, click "Add python.exe to Path" (you may have to scroll down) and select "Will be installed on local hard drive".
Then continue the installation as normal: Go through the above instructions to install labjack-ljm again. To refresh the path, you may need to first open a new terminal or console.
Running Python without adding it to the path
After Python is installed you can run the Python executable from its path without adding it to the path. For example:
C:\Python27\python.exe -m pip labjack-ljm
The above command uses the Python 2.7 path. Make sure you use the correct path for your installation of Python.
Adding Python to the Windows path
Usually Python is added to the user path, as shown above. Another option is to manually add the Python executable path to the Windows path as described in the Python documentation.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. The following examples in the Basic folder are a great place to start:
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Stream mode and other operations that don't fit in "Write Read Loop with Config" will usually have specific examples, and if something seems to be missing let us know.
from labjack import ljm # Open first found LabJack handle = ljm.openS("ANY", "ANY", "ANY") # Call eReadName to read the serial number from the LabJack. name = "SERIAL_NUMBER" result = ljm.eReadName(handle, name) print("\neReadName result: ") print(" %s = %f" % (name, result))
Python_LJM_2020_11_20.zip contains:
CHANGES.TXT LICENSE.TXT README.TXT setup.cfg setup.py Examples\Basic\eAddresses.py Examples\Basic\eNames.py Examples\Basic\eReadAddress.py Examples\Basic\eReadAddresses.py Examples\Basic\eReadName.py Examples\Basic\eReadNames.py Examples\Basic\eWriteAddress.py Examples\Basic\eWriteAddresses.py Examples\Basic\eWriteName.py Examples\Basic\eWriteNames.py Examples\Basic\write_read_loop_with_config.py Examples\More\1-Wire\1_wire.py Examples\More\AIN\dual_ain_loop.py Examples\More\AIN\single_ain.py Examples\More\AIN\single_ain_with_config.py Examples\More\Config\read_config.py Examples\More\Config\read_device_name_string.py Examples\More\Config\write_device_name_string.py Examples\More\Config\write_power_config.py Examples\More\DIO\single_dio_read.py Examples\More\DIO\single_dio_write.py Examples\More\DIO_EF\dio_ef_config_1_pwm_and_1_counter.py Examples\More\Ethernet\read_ethernet_config.py Examples\More\Ethernet\read_ethernet_mac.py Examples\More\Ethernet\write_ethernet_config.py Examples\More\I2C\i2c_eeprom.py Examples\More\List_All\list_all.py Examples\More\Lua\lua_execution_control.py Examples\More\SD\__init__.py Examples\More\SD\change_directory.py Examples\More\SD\delete_file.py Examples\More\SD\get_disk_info.py Examples\More\SD\list_directory.py Examples\More\SD\print_working_directory.py Examples\More\SD\read_file.py Examples\More\SD\sd_util.py Examples\More\SPI\spi.py Examples\More\Stream\advanced_aperiodic_stream_out.py Examples\More\Stream\ljm_stream_util.py Examples\More\Stream\periodic_stream_out.py Examples\More\Stream\stream_basic.py Examples\More\Stream\stream_basic_with_stream_out.py Examples\More\Stream\stream_burst.py Examples\More\Stream\stream_callback.py Examples\More\Stream\stream_in_with_aperiodic_stream_out.py Examples\More\Stream\stream_sequential_ain.py Examples\More\Stream\stream_triggered.py Examples\More\Testing\auto_reconnect_test.py Examples\More\Testing\c-r_speed_test.py Examples\More\Watchdog\read_watchdog_config.py Examples\More\Watchdog\write_watchdog_config.py Examples\More\WiFi\read_wifi_config.py Examples\More\WiFi\read_wifi_mac.py Examples\More\WiFi\read_wifi_rssi.py Examples\More\WiFi\write_wifi_config.py labjack\__init__.py labjack\ljm\__init__.py labjack\ljm\constants.py labjack\ljm\errorcodes.py labjack\ljm\ljm.py
Some additional Python examples can be found through our GitHub account and in the repository supplementary-ljm-examples/python.
This is an example program that illustrates how simple it is to collect data from a LabJack device using the LJM library and log it to a file using Python. The example's source code is available through the supplementary-ljm-examples GitHub repository.
Visual Basic for Applications (VBA) and Visual Basic 6 (VB6) module and examples for the LJM library.
Includes a VB6 project and a VBA Excel example. For Visual Basic .NET examples, go to the C# and VB .NET examples page.
Note to VBA Users: The VB6 example demonstrates additional LJM usage. VB6 code can be used in VBA, so take a look at the VB6 example as well. The VB6 example's .frm file contains the source code and can be opened in any text editor.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
VBA_LJM_2017_03_06.zip contains:
LabJackM_VB.bas LJM_VB6_eFunctions\LJM_VB6_eFunctions.frm LJM_VB6_eFunctions\LJM_VB6_eFunctions.frx LJM_VB6_eFunctions\LJM_VB6_eFunctions.vbp LJM_VBA_eFunctions\LJM_VBA_eFunctions.xls LJM_VBA_SimpleStream\LJM_VBA_SimpleStream.xls
DASYLab is an icon-based data acquisition, graphics, and control software. The driver package below enables users to interface with LabJack T-Series devices using DASYLab.
DASYLab driver for LabJack T-Series devices.
Includes:
Installation:
When first starting DASYLab, you should see LabJack.DLL loaded in the console window if the driver was loaded properly.
Any visible device hardware can be configured by navigating to: Measurement >> Hardware Setup >> LabJack >> LJM.
Configurations will be saved to INI files under C:\Users\Public\Documents\DASYLab\15.1.0\eng\devices\LABJACK-LJM-TASK. The 15.1.0 folder should correspond to the DASYLab version. When exporting a circuit diagram to a new computer, the associated INI configuration files should be exported as well. The name of a task holds the following information:
Device IO can be controlled using modules. LabJack modules are found under: Modules >> Inputs / Outputs >> LabJack >> DAQ.
To modify acquisition rates and other measurement details, navigate to: Measurement >> Measurement Setup >> LabJack >> DAQ Measurement Setup.
Basic project and example for LabWindows/CVI and the LJM library. C/C++ code derived from the LJM C/C++ examples. Please download those for additional example code.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
LabWindowsCVI_LJM_2016_02_24.zip contains:
SimpleCVI_LJM.c SimpleCVI_LJM.prj
Node.js examples for the LJM library. The source code for the LJM Node.js library is also available on GitHub and npm.
LJM stream functions do not work.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
Look at the ljm-ffi git repository for more information.
// Load the LJM Library. var ljm_ffi = require('../lib/ljm-ffi'); var ljm = ljm_ffi.load(); // Load a utility function to get the connected device's info. var utils = require('./utils/utils'); var getHandleInfoSync = utils.getHandleInfoSync; // Define a variable that will store data from LJM function calls var data; // Define a variable that will store the device's handle. var handle; // Open the first found T7. data = ljm.LJM_OpenS('LJM_dtT7', 'LJM_ctANY', 'LJM_idANY', 0); // Exit the program if a device was not found. if(data.ljmError !== 0) { console.log('Failed to open a device, please connect a T7 to your computer.'); process.exit(); } else { handle = data.handle; console.log('Connected to device:', getHandleInfoSync(handle)); } // Read the T7's AIN0. data = ljm.LJM_eReadName(handle, 'AIN0', 0); console.log('AIN0', data.Value); // Close the device. data = ljm.LJM_Close(handle);
nodejs_ljm_2016_1_11.zip contains:
.gitignore package.json README.md examples\hello_world.js examples\read_analog_input.js examples\write_analog_output.js examples\misc\hello_world.js examples\utils\utils.js lib\ljm-ffi.js lib\ljm_functions.js lib\type_helpers.js test\basic_ljm_calls.js test\get_ljm_version.js test\test.js test\test_type_helpers.js test\ljm_calls\device_scanning.js test\ljm_calls\ljm_calls.js test\ljm_calls\open_all_testing.js
Cross-platform Processing examples for the LJM library.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
These examples are based off of the original work by Jason and sent to us in the forum topic processing-language. Further explanations and some ideas for distributing processing applications can be found on the forum topic as well. Jason's description and example .zip file is located in comments #3, #4, and #6.
Processing_LJM_2016_09_26.zip contains:
Processing_LJM_2016_09_26\.DS_Store Processing_LJM_2016_09_26\LICENSE.txt Processing_LJM_2016_09_26\README.txt Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\LJM.java Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\LJMException.java Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\Serial_number_4_AINs_and_DAC0.pde Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\code\jna.jar Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\code\ljm.jar Processing_LJM_2016_09_26\Serial_number_and_4_AINs\LJM.java Processing_LJM_2016_09_26\Serial_number_and_4_AINs\LJMException.java Processing_LJM_2016_09_26\Serial_number_and_4_AINs\Serial_number_and_4_AINs.pde Processing_LJM_2016_09_26\Serial_number_and_4_AINs\code\jna.jar Processing_LJM_2016_09_26\Serial_number_and_4_AINs\code\ljm.jar __MACOSX\Processing_LJM_2016_09_26\._.DS_Store __MACOSX\Processing_LJM_2016_09_26\._Serial_number_and_4_AINs __MACOSX\Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\._code __MACOSX\Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\._LJM.java __MACOSX\Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\._LJMException.java __MACOSX\Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\code\._jna.jar __MACOSX\Processing_LJM_2016_09_26\Serial_number_4_AINs_and_DAC0\code\._ljm.jar __MACOSX\Processing_LJM_2016_09_26\Serial_number_and_4_AINs\._code __MACOSX\Processing_LJM_2016_09_26\Serial_number_and_4_AINs\._LJM.java __MACOSX\Processing_LJM_2016_09_26\Serial_number_and_4_AINs\._LJMException.java __MACOSX\Processing_LJM_2016_09_26\Serial_number_and_4_AINs\code\._jna.jar __MACOSX\Processing_LJM_2016_09_26\Serial_number_and_4_AINs\code\._ljm.jar
VEE is a graphical programming language, as demonstrated in the code snippet below, but understand that it is still a programming language, not a simple software tool.
Note that using a LabJack in VEE is not identical to using Keysight hardware in VEE. Keysight hardware interfaces with the "Instrument Manager," while LabJack hardware talks through the LJM driver. That means that you will not use the "Instrument Manager" or similar Keysight wizards.
With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers. Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.
This example uses 5 calls to the LJM library:
Note that Keysight used to be Aligent Technologies, so this download may contain references to Aligent.
VEE_LJM_2014_07_16.zip contains:
LabJackM_VEE.h ReadMe.txt VEE-Code-Snippet.png Examples\LJM_eAddresses Example.vee Examples\LJM_eNames Example.vee Examples\LJM_eReadAddress Example.vee Examples\LJM_eReadAddresses Example.vee Examples\LJM_eReadName Example.vee Examples\LJM_eReadNames Example.vee Examples\LJM_eWriteAddress Example.vee Examples\LJM_eWriteAddresses Example.vee Examples\LJM_eWriteName Example.vee Examples\LJM_eWriteNames Example.vee Examples\AIN\Dual AIN Loop.vee Examples\AIN\Single AIN with config.vee Examples\AIN\Single AIN.vee Examples\Config\Read Config.vee Examples\Config\Read DeviceName String.vee Examples\Config\Write DeviceName String.vee Examples\Config\Write Power Config.vee Examples\DIO\Single DIO Read.vee Examples\DIO\Single DIO Write.vee Examples\Ethernet\Read Ethernet Config.vee Examples\Ethernet\Read Ethernet MAC.vee Examples\Ethernet\Write Ethernet Config.vee Examples\I2C\I2C EEPROM Read.vee Examples\I2C\I2C EEPROM Write-and-Read.vee Examples\I2C\I2C EEPROM Write.vee Examples\SPI\SPI.vee Examples\Stream\Stream Basic.vee Examples\Watchdog\Read Watchdog Config.vee Examples\Watchdog\Write Watchdog Config.vee Examples\WiFi\Read WiFi Config.vee Examples\WiFi\Write WiFi Config.vee functions\LJM.vbl.vee
LabJack makes wrappers and libraries available for many languages for the UD library.
The UD library is the Windows library/driver for the UD series of devices, the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Examples In... | Windows | Mac | Linux |
---|---|---|---|
DAQFactory | ✔ | ||
LabVIEW | ✔ | ||
C, C++, VC6 | ✔ | ||
C, C++ | ✔ | ✔ | |
Python | ✔ | ✔ | ✔ |
Visual Basic (VB6, VBA) | ✔ | ||
.Net (C#, VB) | ✔ | ||
Java | ✔ | ||
Delphi | ✔ | ||
MATLAB | ✔ | ||
Agilent VEE | ✔ | ||
Igor Pro | ✔ | ||
PureBasic | ✔ | ||
LabWindows/CVI | ✔ | ||
DASYLab | ✔ |
The attached quick reference .rtf files are useful when programming with the UD library. Each quick reference guide is tailored to a specific device, so it is easy to find relevant constants and copy them into your code.
DAQFactory examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
DAQFactory is measurement and automation software from Azeotech. For general information go to www.azeotech.com, and for information specific to DAQFactory Express go to www.daqexpress.com.
The first item of the File Attachments is an archive containing all examples referenced in the DAQFactory - LabJack Application Guide. The other items are miscellaneous additional examples.
To get started using DAQFactory with the LabJack UD library (U3, U6, UE9), go through the Quick Tutorial and refer to the DAQFactory LabJack Application Guide:
https://labjack.com/support/software/3rd-party-applications/daqfactory
LabJack support can sometimes help with DAQFactory questions, but often the AzeoTech forum is the best resource:
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
We currently offer two options for communicating with DASYLab. If you are can use version 11 or higher, we strongly suggest that you use Modbus to communicate with your device.
The other option is LabJackDASY, which is very rough. This alpha-release was done with the old style Dasylab DDK, whereas the new way is using the extension toolkit which requires Dasylab 9+.
DASYLab began offering support for Modbus TCP in version 11 service pack 1. The T4, T7, and UE9 natively supports this protocol when connected over Ethernet. With LJSocket, any program capable of Modbus TCP can communicate with UD family devices (U3, U6 and UE9) over USB. Since DASYLab provides built in support for analog and digital I/O through this convenient protocol, we suggest that our clients utilize those native modules if possible. However, please note that Modbus does not expose some of our devices' more advanced functionality, particularly stream mode.
T4 and T7 over Ethernet: Modbus over Ethernet will work with all firmware versions.
UE9 over Ethernet: Modbus over Ethernet will require version 1.41 of the communications firmware and version 2.04 of the control firmware. However, we suggest that you use more recent releases if possible. We conducted our testing with version 1.50 and 2.18 of the communication and control firmware respectively. As of this writing, both of these releases are in beta and, thus, we provide these versions on our beta firmware page. More information on firmware upgrades can be found on our firmware page.
Any UD Family Device over USB with LJSocket: Please refer to our LJSocket documentation.
Setting Up DASYLab: DASYLab introduced support for Modbus over TCP in version 11 service pack 1 before improving upon it in service pack 2. The modules can be found in the "Modules" tab under the "Inputs/Outputs" node. As described in the "configuration" section below, you should Analog Input and Analog Output modules for all operations, even digital I/O. After placing a module, double click on it to change its properties.
A screen shot demonstrating this configuration has been attached below for your convenience.
Configuration: The Analog Input and Analog Output modules are analogous to read and write register respectively. The "Data Type" drop down controls how many registers are read at once. For example, use "Float" for reading AIN and "Word" for controlling FIO lines.
Error Handling: In our testing we found that when using LJSocket, the first attempt at reading from a device not attached to a local computer may timeout. If you have this issue, we suggest you change the "Error Handling" option under the "Interface" button to the "Ignore Error" option. It may still be beneficial, however, to save the error in a global variable to deal with it during the experiment in the event that it is more serious.
DASYLab driver for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Please refer to the "Readme.txt" file in the zip for information regarding installation instructions and limitations.
The beta version should work with DASYLab 9+.
If you are using an older version of DASYLab use the DASYLab 7 & 8 download.
Delphi wrapper and examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Refer to the text file in the download for more information.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
Visual C/C++ examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
These examples demonstrate static linking (load-time dynamic linking). The UD library dlls are required for the applications to load. To see a few examples using run-time dynamic linking, see the Dev-C examples.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
Basic example for Dev-C++ 4.9.9.2 (with Mingw port of GCC, bloodshed.net) and the LabJackUD driver. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Demonstrates run-time dynamic linking where the UD library is loaded during application run-time instead of load-time. This type of linking is supported in many Windows C compilers including Borland, and is an alternative to using static linking (load-time dynamic linking) with the LabJackUD.lib file as demonstrated in the Visual C/C++ examples.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
C# and VB .NET examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Refer to the text file in the download for more information.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
This download allows Igor Pro developers to utilize the Windows UD library, featuring both an XOP and examples. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
Java wrappers and examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
The latest and recommended Java wrapper and examples for the Windows UD driver. Requires JNA and supports 32 and 64-bit Java and UD driver. Refer to the download's README.txt for requirements, compile/run instructions, documentation and license information.
The old Java wrapper and examples which are no longer updated. Uses a JNI dll and only supports 32-bit Java and UD driver. Refer to the text file in the zip for more information.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
LabVIEW driver/example VIs for the Windows UD library. The Windows UD library is the high-level Windows library for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
LabVIEW is one of the most popular programming languages used by our customers. LabVIEW is a graphical programming language, as demonstrated in the code snippet below, but understand that it is still a powerful programming language not a simple software tool.
http://www.ni.com/gettingstarted/labviewbasics/
Note that using a LabJack in LabVIEW is not identical to using NI hardware in LabVIEW. The NI hardware is talked to through the NI-DAQ driver, while the LabJack is talked to through the LabJack UD library. That means that you will not use measurement & automation explorer, DAQ assistant, or similar NI wizards.
The LabVIEW_LJUD archive is maintained in LabVIEW 7.1, but also available below are the last supported archives for LabVIEW 5 & 6.
The LabVIEW_NXG_LJUD archive is only compatible with LabVIEW NXG and similarly the LabVIEW_LJUD archive is not compatible with LabVIEW NXG.
Our normal software installation package is required by the attached LabVIEW examples. You can find the latest version of that here.
The UD library has easy functions to read or write a single analog or digital I/O. For basic applications these might be all that are needed:
For more flexible and efficient operation you would move on to the basic Add-Go-Get technique described in Section 4.1 of the U3/U6/UE9 User's Guide. With this technique you give the drive a list of requests to perform (Add), execute the list (Go), and read the results of each request (Get). There are a few different functions to perform different variations of Add-Go-Get, but they all have the same parameters:
6000 is added to the LabJack errorcodes to shift them into the LabVIEW user range of 5000-9999. For example, if the open call cannot find the device you requested it will return LabVIEW_LJUD errorcode 7007, which is UD errorcode 1007. Many errorcodes are listed in Section 4 of the respective device datasheet (U3/U6/UE9), but every LabVIEW program should use LJUD_ErrorToString.vi to convert the errorcode to a readable string.
Refer to Section 4.2 of the U3/U6/UE9 User's Guide for documentation of the parameters of each function.
The pseudocode sections, 4.3 of the U3/U6/UE9 User's Guide, are a good spot to look for this information. Also see the applicable Hardware Description section in the U3/U6/UE9 User's Guide.
The downloadable zip file "LabVIEW_LJUD-year-month-day.zip" extracts to a single folder called "LabVIEW_LJUD-year-month-day" which contains a few subfolders. The archive can be stored anywhere, but if you want icons to show up on the LabVIEW function palette (after restarting LabVIEW) place the folder containing the Examples folder, LabJackUD DLL Functions folder, dir.mnu, etc. under ...\national instruments\labview #\vi.lib\addons\ (create the addons folder if it does not exist). Be sure your folder is named "LabVIEW_LJUD" when added to the LabVIEW addons folder or else the icons may not load properly. If you just see question marks, see this related forum topic.
Many people, including us, do not use the palette icons but rather just copy paste from examples and use the "Select a VI..." balloon from the function palette. In that case you can put the LabVIEW_LJUD folder wherever you want.
We recommend not having more than one copy of the VIs, and not changing these VIs. If you want to make your own variation of one of the examples, make a copy in a different location and modify that.
If you download new VIs from labjack.com, delete and replace the entire LabVIEW_LJUD folder.
Basic example for LabWindows/CVI and the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
The attached archive has 1 simple example, but what is most important about this example is it shows how to use any of the many examples from our VC6_LJUD archive in CVI.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
MATLAB examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
The recommended examples for modern MATLAB. Requires MATLAB R2009a (7.8) and later. The ".NET Examples for MATLAB" attachment below provides examples that use the MATLAB .NET interface and the UD .NET assembly. No compiler tools are necessary. Refer to the README.txt in the download for details. Download dated 04/25/2018 are the latest.
Note to MATLAB 2018a and newer users: If you have script code using a LabJack that was working in previous MATLAB versions but is now getting "Undefined variable" errors when using enumerations, refer to the latest download's README.txt file, section "Changes for MATLAB 2018a and Newer", for solutions.
The old MATLAB drivers and examples version 1.32. See the PDF included in the download zip. Tested on MATLAB 7.0, but should work with 6.5 or newer.
This should work for most 32-bit versions of MATLAB. Due to how MATLAB handles calls to .dlls, additional steps are needed for work with 64-bit MATLAB. In addition to needing the 64-bit LabJackUD.dll you must also have a set of compiler tools to call the functions.
See this for an example of how to set that up with MATLAB 7.7
For MATLAB R2010a you can get more information here for 32-bit versions and here for 64-bit versions.
For MATLAB R2011b you can get more information here for 32-bit versions and here for 64-bit versions.
For MATLAB R2012b you can get more information here for 32-bit versions and here for 64-bit versions.
For other versions please see the "Supported Compilers" column on this page.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
PureBasic examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Warning: If you intend to create a 64-bit application please ensure you use AddRequestPtr rather than AddRequest anywhere you write or read an array of data. See our AddRequest documentation for more information.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
LabJackPython is our cross-platform Python module for communicating with the LabJack U3, U6, UE9, and U12. It works on Windows with the UD Driver and U12 Driver, and on Linux and macOS with the Exodriver. For the LJM library (T7, T4, and Digit), use Python_LJM.
For LabJackPython examples, please see the Examples directory in the LabJackPython download, or see on GitHub: https://github.com/labjack/LabJackPython/tree/master/Examples
The latest release of LabJackPython is 2.0.4 from September 9, 2020: Download the 2.0.4 release of LabJackPython.
For the latest development version, archived versions and code repository, visit LabJackPython on GitHub.
LabJackPython 2.0.4 is available using pip via PyPI.
To control UD devices using Python, the LabJackPython Python package and the UD Driver or Exodriver must be installed.
if pip is available, the latest LabJackPython package can be downloaded by navigating to a command line and running:
python -m pip install LabJackPython
or:
pip install LabJackPython
LabJackPython can also be downloaded from our source archives. Unzip the LabJackPython.zip file and open a terminal/command prompt. In the terminal, use the command line to go to the unzipped LabJackPython directory (e.g., “cd Desktop/LabJackPython”). Then run one of the following commands to install the LabJackPython modules:
Windows
python setup.py install
Linux and macOS
$ sudo python setup.py install
Note the LabJackPython zip file and unzipped directory name will vary on the download.
If running the above command causes a "'python' is not recognized as an internal or external command, operable program or batch file." or similar error, that means either Python is not installed on your computer or the Python executable's path was not added to the Windows user or system path. To help resolve this issue, please run the Python Windows installer and in the "Customize Python" window, click the "Add python.exe to Path" option towards the bottom and select "Will be installed on local hard drive".
Then finish the Python installation. Open a new terminal/console window and then go through our LabJackPython installation instructions again.
Alternatively, after Python is installed you can run the Python executable from its path. For example:
C:\Python27\python.exe setup.py install
Note that the above command uses the Python 2.7 path, and you should use the correct path on your computer which may differ.
Another option is to manually add the Python executable's path to the Windows path as described in the Python documentation.
macOS: As of macOS 10.15, opening a U6 the first time after plugging it in sometimes fails. Subsequent attempts to open succeed.
For documentation, please refer to the docstrings in the source code or use the help function on the module, class, or method.
For the U3, refer to its u3.py source, or use the “help(u3)” call in Python (“import u3” beforehand).
For the U6, refer to its u6.py source, or use the “help(u6)” call in Python (“import u6” beforehand).
For the UE9, refer to its ue9.py source, or use the “help(ue9)” call in Python (“import ue9” beforehand).
For the U12, refer to its u12.py source, or use the “help(u12)” call in Python (“import u12” beforehand).
LabJackPython provides both a Modbus and low-level command interface for performing operations on a LabJack device. Quickstarts can be found for both in the Modbus Quickstart and Low-level Commands Quickstart sections.
This quickstart uses a U3-HV, but the principles and most of the code apply to all LabJack devices.
Here’s how to open a U3:
>>> import u3
>>> d = u3.U3()
The constructor for the U3 class will try to automatically open the first found U3. This is good if you only have one U3 connected.
Wire a jumper from DAC0 to AIN0, connect an LED from FIO4 to VS and jumper FIO6 to GND. Wire the anode (longer-lead) of the LED to VS and the cathode to FIO4. For more information on controlling LEDs, refer to the LED app note . The LED connection we are using is configuration 2 in the app note.
Set DAC0 to 1.5 V, and read the voltage on AIN0:
>>> DAC0_REGISTER = 5000
>>> d.writeRegister(DAC0_REGISTER, 1.5) # Set DAC0 to 1.5 V
1.5
>>> AIN0_REGISTER = 0
>>> d.readRegister(AIN0_REGISTER) # Read from AIN0
1.5252180099487305
In this example, we’re using the LabJack’s Modbus interface, which is register-based. The values of DAC0_REGISTER and AIN0_REGISTER are taken from the UD Modbus map. Find the table at the bottom of the UD Modbus page in the "UD Modbus Map" section. What register is DAC1 located at? Check the map, and confirm that it’s at 5002.
Now toggle the LED by setting FIO4 to output low and output high:
>>> FIO4_STATE_REGISTER = 6004
>>> d.writeRegister(FIO4_STATE_REGISTER, 0) # Set FIO4 low, LED on
0
>>> d.writeRegister(FIO4_STATE_REGISTER, 1) # Set FIO4 high, LED off
1
The value of FIO4_STATE_REGISTER is also taken from the UD Modbus map. Verify that the LED toggles on and off as FIO4’s state changes from low to high.
Now use FIO6 for digital input. First, we configure it for input, then we read its state:
>>> FIO6_DIR_REGISTER = 6106
>>> FIO6_STATE_REGISTER = 6006
>>> d.writeRegister(FIO6_DIR_REGISTER, 0) # Set FIO4 to digital input
0
>>> d.readRegister(FIO6_STATE_REGISTER) # Read the state of FIO6
0
>>> # Disconnect GND or connect FIO6 to VS
>>> d.readRegister(FIO6_STATE_REGISTER)
1
>>> # Reconnect GND
>>> d.readRegister(FIO6_STATE_REGISTER)
0
With FIO6 connected to GND, reading digital input on FIO6 reads low (0). When GND is disconnected, the FIO’s internal pull-up resistor causes its state to be high (1). With FIO6 connected to VS, reading the digital input on FIO6 reads high (1).
In this quickstart, we’ve used the LabJack’s Modbus interface to use DAC0, AIN0, FIO4 and FIO6. For more examples of using Modbus, consult the workingWithModbus.py distributed with LabJackPython. The UD Modbus map is also essential for involved Modbus work.
This quickstart uses a U3-HV, but the principles apply to all LabJack devices.
Here’s how to open a U3:
>>> import u3
>>> d = u3.U3()
The constructor for the U3 class will try to automatically open the first found U3. This is good if you only have one U3 connected.
First, before we perform any other operation we will get your LabJack device’s calibration data. This only needs to be performed once after opening your device. The calibration data will be used by functions that convert binary data to voltage/temperature and vice versa.
>>> d.getCalibrationData()
Wire a jumper from DAC0 to AIN0, connect an LED from FIO4 to VS and jumper FIO6 to GND. Wire the anode (longer-lead) of the LED to VS and the cathode to FIO4. For more information on controlling LEDs, refer to the LED app note . The LED connection we are using is configuration 2 in the app note.
Setting the DAC is a U3 Feedback command, so we’ll use the U3 class getFeedback() function. For every Feedback command, there is a corresponding class in u3.py. The 8-bit DAC0 feedback command from Section 5.2.5.13 has a class named DAC0_8. Here’s how to use it:
>>> DAC0_VALUE = d.voltageToDACBits(1.5, dacNumber = 0, is16Bits = False)
>>> d.getFeedback(u3.DAC0_8(DAC0_VALUE)) # Set DAC0 to 1.5 V
As the documentation in Section 5.2.5.13 states, the 8-bit DAC0 feedback command takes a value between 0 and 255 (inclusive) and the output of the DAC is between 0 and 4.95 V. The variable DAC0_VALUE converts between the two. Reading from an analog input is also a feedback command. As Section 5.2.5.1 of the U3 User’s Guide states, the feedback command returns a 16-bit unsigned value that we must convert into a voltage. Here’s how to do that:
>>> ain0bits, = d.getFeedback(u3.AIN(0)) # Read from raw bits from AIN0
>>> print(ain0bits)
37584
>>> ainValue = d.binaryToCalibratedAnalogVoltage(ain0bits, isLowVoltage = False, channelNumber = 0)
>>> print(ainValue)
1.501376
Similar to setting DAC0, we use the getFeedback() function and the AIN class from the u3 module (u3.AIN). The getFeedback() function always returns a list (more on that later), and so we use a trailing comma after ain0bits:
>>> ain0bits, = d.getFeedback(u3.AIN(0))
to automatically unpack the first value in the list. The U3 class has a function binaryToCalibratedAnalogVoltage() that knows how to apply the proper calibration constants to convert the reading into a voltage. The function applies different constants based on whether we are using a U3-LV (default) or one of the high-voltage inputs on the U3-HV. When using a high-voltage input, we specify isLowVoltage = False. For the U3-HV, the channel number (channelNumber) also needs to be specified so the correct calibrations constants are applied.
Because reading an analog input is such a common operation, the U3 class provides a getAIN() function that calls getFeedback() and binaryToCalibratedAnalogVoltage() with the correct parameters:
>>> ainValue = d.getAIN(0) # Read from AIN0 in one function
>>> print(ainValue)
1.501376
Setting a digital line’s state and direction is also done with feedback commands. The relevant ones are BitStateRead, BitStateWrite, BitDirRead, and BitDirWrite.
# Check which FIOs are analog and which are digital
>>> configDict = d.configIO()
>>> configDict["FIOAnalog"]
63
# Set the first four (0-3) to analog (15 = 1111 binary) and the rest to digital
>>> d.configIO(FIOAnalog = 15)
>>> d.getFeedback(u3.BitDirWrite(4, 1)) # Set FIO4 to digital output
[None]
>>> d.getFeedback(u3.BitStateWrite(4, 0)) # Set FIO4 to output low
[None]
>>> d.getFeedback(u3.BitStateWrite(4, 1)) # Set FIO4 to output high
[None]
Note the call to configIO(), which is not a feedback command, but a low-level command in Section 5.2.3. All the low-level commands in Section 5.2 are implemented as functions of the U3 class.
The getFeedback() function also accepts a list of feedback commands, and it accepts multiple arguments directly. For example, here’s how to set FIO4 for digital output and output high at the same time:
>>> outputDirCmd = u3.BitDirWrite(4, 1)
>>> outputHighCmd = u3.BitStateWrite(4, 1)
>>> cmdList = [outputDirCmd, outputHighCmd]
>>> d.getFeedback(cmdList) # Pass a list of commands
[None, None]
>>> d.getFeedback(outputDirCmd, outputHighCmd) # Or pass the commands as arguments
[None, None]
which is exactly what the setFIOState() convenience function does:
>>> d.setFIOState(4, 1) # Set FIO output high in one function
>>> d.setFIOState(4, 0) # Set FIO output low in one function
When you pass multiple feedback commands to getFeedback(), the function processes them sequentially. Here is an example of checking the direction of FIO4 (it’s set to output from above), set the FIO4 direction to input, and read FIO4 direction:
# Multiple feedback commands
# Read FIO4's direction
# Set FIO4's direction to input
# Read FIO4's direction again
>>> d.getFeedback(u3.BitDirRead(4), u3.BitDirWrite(4, 0), u3.BitDirRead(4))
[1, None, 0]
Now lets set FIO6’s direction to input and read its state:
# Set FIO6's direction to input and read its state
>>> d.getFeedback(u3.BitDirWrite(6, 0), u3.BitStateRead(6))
[None, 0]
# Disconnect from GND
>>> d.getFeedback(u3.BitStateRead(6))
[1]
# Reconnect to GND
>>> d.getFeedback(u3.BitStateRead(6))
[0]
To get the actual state (first value of the list), don’t forget to unpack it:
>>> v, = d.getFeedback(u3.BitStateRead(6))
>>> v
0
>>> v = d.getFeedback(u3.BitStateRead(6))[0]
>>> v
0
which is exactly what the getFIOState() convenience function does:
>>> d.getFIOState(6)
0
We’ve recreated all the Modbus Quickstart (readRegister() and writeRegister()) operations on DAC0, AIN0, FIO4 and FIO6 using low-level commands. Many low-level commands are feedback commands, so they are passed into getFeedback(), which is a very flexible function that can perform many operations on your device at once. To go beyond the basic low-level operations (basic analog and digital), explore the other built-in commands and the LabJackPython source as described in the sections below.
Section 5.2 of the U3 User’s Guide describes the low-level commands. All the low-level commands in the U3 User’s Guide have been defined as functions in the U3 LabJackPython class.
For example, we can get helpful information by calling the configU3() command. Note that in Section 5.2.2 of the U3 User’s Guide is a description of ConfigU3.
Here we are going to call configU3 with no arguments to perform only a read.
>>> print(d.configU3())
{
'LocalID': 5,
'SerialNumber': 32003XXXX,
'DAC1Enable': 1,
'EIODirection': 0,
'DeviceName': 'U3-HV',
...
}
The configU3() function sets the power-up defaults of the U3. To change the U3’s behavior for this session only, use configIO(). For example, to set the first five FIO lines to analog for this session, call configIO with the FIOAnalog keyword argument:
>>> d.configIO(FIOAnalog = 0x1F)
{'DAC1Enable': 0, 'FIOAnalog': 31, 'EIOAnalog': 0, 'TimerCounterConfig': 64}
The value 0x1F is a bitmask with the lower 5 bits set to 1, signifying the first five FIOs. To make this setting survive power cycles, call configU3() instead of configIO():
>>> d.configU3(FIOAnalog = 0x1F)
{...
'FIOAnalog': 31,
...
}
>>> d.close()
>>> # Unplug the U3 and plug it back in
>>> d.open()
>>> d.configU3()
{...
'FIOAnalog': 31,
...
}
Some of the best low-level documentation of LabJackPython is in the docstrings of the source code. For example, the u3.py module has many examples for the low-level commands. The feedback commands are implemented as classes at the bottom of the module, and every feedback command has a docstring with an example of how to use it.
Keysight VEE examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
Refer to the text file in the .zip for more information.
Updated December 1, 2010: Added I2C and Tick-DAC examples. Requires UD driver 3.24+ to work.
Note: Keysight used to be Aligent Technologies, so this download may contain references to Aligent.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
Visual Basic module and examples for the Windows UD library. The Windows UD library is the high-level Windows library/driver for the LabJack U3, U6 and UE9. For other LabJack devices, go to the Software page.
The examples are VB6 projects and VBA Excel spreadsheets. For VB .NET, we recommend our DotNet archive.
Note to VBA Users: The VB6 examples demonstrate additional UD library usage. VB6 code can be used in VBA, so take a look at the VB6 example as well. The VB6 example's .frm file contains the source code and can be opened in any text editor.
64-bit Compatibility: The PtrSafe keyword is required on function declarations to allow 64-bit compatibility. The PtrSafe keyword is not valid in older VBA versions, so our main example package does not include this keyword on declarations. To add 64-bit compatibility, please replace the LabJackUD_VB.bas file in your example package with the file downloaded by clicking here.
First read the general overview of the UD library:
https://labjack.com/support/software/api/ud/overview
The UD driver has a handful of functions, many with the same 4 to 6 parameters.
The main functions are used to build a list of requests (Add), execute the list (Go), and read the result of each request (Get). Some functions (e.g. eGet) combine a single add/go/get into one function call.
The parameters are described at the bottom of the Overview page. The meaning of each parameter should be apparent (e.g. Channel is the channel number you are operating on), but when it is not the pseudocode section of the device's datasheet has the extra information needed.
Device specific pseudocode can be found in datasheet section 4.3:
U3: https://labjack.com/support/datasheets/u3/high-level-driver/example-pseudocode
U6: https://labjack.com/support/datasheets/u6/high-level-driver/example-pseudocode
UE9: https://labjack.com/support/datasheets/ue9/high-level-driver/example-pseudocode
LabJack T-Series devices speak Modbus TCP. This makes them compatible with dozens of 3rd-party libraries. For most applications, however, LabJack recommends using the LJM library as it is simpler than using direct Modbus. Other reasons include:
Reasons to use direct Modbus
The T7 and T4 have five test registers that should be used before trying to read/write to other registers. This will help in trying to debug any getting-started related issues with addressing or bit-wise (byte-flipping) issues.
The Modbus Map defines the address and name of all registers, along with other information. This section has a dynamic map that allows you to filter and search.
For more information about LabJack's direct Modbus implementation check out the API documentation section.
Libraries... | Windows | Mac | Linux |
---|---|---|---|
LabVIEW | ✔ | ✔ | ✔ |
Node.js | ✔ | ✔ | ✔ |
Python | ✔ | ✔ | ✔ |
C/C++ (Streaming) | ✔ | ✔ | ✔ |
C# .NET | ✔ |
To use a 3rd party Modbus program, such as a Rockwell/Allen Bradley application, follow the instructions on the Modbus Client Applications page.
More information about Modbus as well as some getting started information can be found on the Modbus API Documentation page. A list of the available Modbus registers is available on the Modbus Map page.
To get started with direct Modbus TCP when using any HMI, PLC, or a 3rd party Modbus Client Application, first try writing & reading to/from the test registers.
See the Examples section on the Modbus Protocol Details page.
If using COTS Modbus Client software, keep the following in mind:
If you don't have a better way to see the bytes written and read for each packet, you can use Wireshark to get a TCP capture.
Name | Start Address | Type | Access | Default |
TEST | 55100 | UINT32 | R | 1122867 |
TEST_UINT16 | 55110 | UINT16 | R/W | 17 |
TEST_UINT32 | 55120 | UINT32 | R/W | 1122867 |
TEST_INT32 | 55122 | INT32 | R/W | -2003195205 |
TEST_FLOAT32 | 55124 | FLOAT32 | R/W | -9999.0 |
Below is a list of some common issues that customers tend to deal with when configuring & setting up Modbus Client Applications:
More getting started information and general Modbus resources can be found on the Modbus API Documentation page.
The filter and search tool above displays information about the Modbus registers of T-series devices.
For the U3, U6 and UE9, see the deprecated Modbus system called UD Modbus.
For a printer-friendly version, see the printable Modbus map.
T-series devices are controlled by reading or writing Modbus registers as described on the Communication page.
Modbus TCP is described further on the Protocol Details page.
T-series devices have a single map of addresses from 0 to 65535. Any type of register can be located anywhere in that address range, regardless of the data type or whether it is read-only, write-only, or read-write.
Some addresses point to buffers that can access more data than what would normally fit within the Modbus address range. See section 3.1.1 for more information on Buffer Registers.
Many registers are sequentially addressed. The Modbus Map gives you the starting address for the first register, and then—depending on whether the data type is 16-bits or 32-bits—you increment the address by 1 or 2 to get the next value:
Address = StartingAddress + 1*Channel# (UINT16)
Address = StartingAddress + 2*Channel# (UINT32, INT32, FLOAT32)
Note that the term "register" is used 2 different ways throughout documentation:
Therefore, most "registers" consist of 1 or 2 "Modbus registers".
For example, the first entry (starting address of 0) in the Modbus Map has the name AIN#(0:254), which is shorthand notation for 255 registers named AIN0, AIN1, AIN2, ..., AIN254. The AIN# data type is FLOAT32, so each value needs 2 Modbus registers, thus the address for a given analog input is channel*2.
Zero-Based Addressing means that the addresses defined in the Modbus Map are the addresses that should be used in the actual Modbus TCP packets.
Some Modbus TCP client software subtracts 1 from all addresses. For example, you tell the client software you want to read address 2000, but it puts 1999 in the actual Modbus TCP packet. That means if you want to read Modbus address 2000 you have to pass 2001 to the client software. We use 0-65535 addressing everywhere, so if you want to read an address we document as 2000, then 2000 should be in the Modbus TCP packet.
Some Modbus TCP client programs use addresses written as 4xxxx, which can refer to the "Holding Register" address block in some Modbus addressing schemes. However, this addressing scheme is not defined as a part of the Modbus specification and LabJack devices do not use this form for addressing. If 4xxxx addressing is encountered in a client program, the xxxx will often refer to the address used in the Modbus packet, or it might also have 1 subtracted before being put into the Modbus packet. For example, address 2000 on the LabJack may be accessible by passing 42000 or 42001 to the client software.
Modbus is specified as big-endian, which means the most significant value is at the lowest address. With a read of a 16-bit (single register) value, the 1st byte returned is the MSB (most significant byte) and the 2nd byte returned is the LSB (least significant byte). With a read of a 32-bit (2 register) value, the value is returned MSW then LSW, where each word is returned MSB then LSB, so the 4 bytes come in order from most significant to least significant.
Some Modbus TCP clients expect Modbus to be implemented with big-endian bytes but with the least significant word before the most significant word. In other words, the client software flips the order of the words within a 32-bit value. For example, a read of TEST (address 55100) should return 0x00112233, but the client returns 0x22330011. Most client programs provide options to change the data interpretation.
Each entry in the map has an associated data type. The data type tells us know to format data being sent to the device and how to interpret data from the device. The raw data in the map contains the integer values below. The Map above displays the type name instead of the integer value.
Type | Integer Value |
---|---|
LJM_UINT16 | 0 |
LJM_UINT32 | 1 |
LJM_INT32 | 2 |
LJM_FLOAT32 | 3 |
LJM_BYTE | 99 |
LJM_STRING | 98 |
LabJack distributes a constants file called ljm_constants.json
that defines information about the Modbus register map. The filter and search tool above pulls data from that JSON file.
The ljm_constants GitHub repository contains up-to-date text versions of the Modbus register map:
National Instruments advertises a free native Modbus TCP/IP library that has been used successfully with our Modbus TCP compatable devices. Some of its features include
The File Attachment (.zip file) below includes a version of their library and some example VI's that read/write the T7 or T4's test registers:
Name | Start Address | Type | Access | Default |
TEST | 55100 | UINT32 | R | 1122867 |
TEST_UINT16 | 55110 | UINT16 | R/W | 17 |
TEST_UINT32 | 55120 | UINT32 | R/W | 1122867 |
TEST_INT32 | 55122 | INT32 | R/W | -2003195205 |
TEST_FLOAT32 | 55124 | FLOAT32 | R/W | -9999.0 |
The File Attachment (.zip file) below also has a .vi that reads AIN0, AIN1, and AIN2 for convenience
There are several Modbus TCP libraries available on npm. We created a GitHub repository that uses a few of the libraries and mentions a few other interesting Modbus libraries called node-modbus_library_testing.
Search for more Modbus related modules on npm.
Run the following commands:
Look at the project's README.md file for more details.
There are several Modbus TCP/UDP libraries available for python that have various dependencies. Below are a few that are worth trying.
Pymodbus is a library released under the BSD License that has been tested to be working with our Modbus TCP compatable devices. The project has some decent documentation and is capable of both Modbus TCP and Modbus UDP requests. It also has the capability of being called synchronously or asynchronously.
Included below is a code snippet for reading from AIN0.
#Import Files from convert_data import * from pymodbus.client.sync import ModbusTcpClient #Open TCP Port client = ModbusTcpClient('192.168.1.15') #Read AIN0 result = client.read_input_registers(0,2) print 'AIN0 val:', data_to_float32(result.registers) #Close TCP Port client.close()
The File Attachment (.zip file) below includes 3 files:
Please note that you need to perform several steps to install this python library described on their websites. These examples won't run until you do.
Name | Start Address | Type | Access | Default |
TEST | 55100 | UINT32 | R | 1122867 |
TEST_UINT16 | 55110 | UINT16 | R/W | 17 |
TEST_UINT32 | 55120 | UINT32 | R/W | 1122867 |
TEST_INT32 | 55122 | INT32 | R/W | -2003195205 |
TEST_FLOAT32 | 55124 | FLOAT32 | R/W | -9999.0 |
The File Attachment (.zip file) below also has a .vi that reads AIN0, AIN1, and AIN2 for convenience
Cross-platform low-level Modbus TCP streaming example written in C/C++ for the LabJack T7 or T4. The C/C++ Modbus TCP functionality used in the example is provided by LabJack. These Modbus functions, provided in modbus.h/.c, in general can be used for Modbus TCP operations and not just for streaming.
Refer to the README.TXT in the download/attachment below for more details.
Note: This is an advanced example for users who can't use the cross-platform LJM library we provide. In most cases using the LJM library is an option and we recommend using its stream functions and examples for ease of use: /support/software/examples/ljm
Updated 12/12/2014.
Direct Modbus TCP examples written in C# .NET for the LabJack T7, T4, and UE9. The C# Modbus TCP class used in the examples is written and provided by LabJack.
If using a third party Modbus TCP class/interface, use our examples as a general demonstration of Modbus TCP usage. The example Write calls use Modbus function 16, Preset Multiple Registers, and the Read calls use Modbus function 3, Read Multiple Registers.
Refer to the README.TXT in the download/attachment below for more details.
Updated 05/24/2019.
The Exodriver library / API is used to communicate over USB with the LabJack U3, U6, UE9 and U12 in Mac OS X and Linux environments. Other APIs and examples on Mac OS X and Linux, such as the LabJackPython for Python and ljacklm for the U12, can require the Exodriver.
There is a limited amount of example code available for the Exodriver, what is available is in the API Documentation section of the website because it is tightly coupled with the Exodriver documentation.
While running a Lua script, the T4, T7, or T7-Pro can operate without computer involvement. Basically, user-specified operations (feedback loops, logging, PID loops) can be conducted via on-board script, which was not possible in previous generations of LabJack hardware. Below is a screenshot of the Lua Scripting section in our free cross-platform program called Kipling.
Kipling's Lua scripting tab is the best way to develop embedded Lua scripts. It simplifies viewing, testing, and configuring Lua scripts. If you are new to Lua Scripting, see you may wish to see Getting Started.
To view Lua scripts without Kipling, please see our Kipling Git repository. (Our examples are also available in Kipling.)
One common application of Lua Scripts is to execute tasks and export status variables to a logging program. These scripts can use USER_RAM registers to pass data from the Lua script to any other program accessing the T-Series device. LabVIEW, C#, Python, or any other supported languages can access the T-Series device and read from or write to these registers. LJLogM can be used for easy logging of data from the various sensors. Several example scripts like these can be found in the I2C Sensor Examples website section.
One prime example is the Accelerometer & Compass Module (LSM303) example in which a script saves data from the sensor to USER_RAM registers. The USER_RAM registers can then be logged by LJLogM.
More can be found in the Lua Scripting section of the T-Series Datasheet.
Reaching the maximum size of a Lua Script using a T7 and T4 is easy to do. The majority of the scripts that we have written show that the maximum size of a script is right around 100 lines. However, the exact size is hard to determine since it ultimately depends on what variables are being defined, how long is each line of code, etc. If you start running into some intermittent errors like "not enough memory", it is time to either refactor your code or re-consider how much you are trying to do in a script. You can try minifying your code using this online Lua Minifier tool.
See the Lua Script Performance.
Lua Scripts have been featured in two LabJack news posts:
New to Lua Scripting on a LabJack? Start here!
These examples provide a brief overview of LabJack Lua scripting functions, including a list of functions as well as everyone's first program, "Hello World".
Video Tutorials
(Also available on YouTube)
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/helpful_information/hello_world.lua
This is a Lua Script that illustrates how to read and format general device information such as the following:
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/helpful_information/device_information.lua
These LabJack functions are very useful when scripting for T-series devices. It may be helpful to read through this script before writing a new Lua script. This contains information specific to the T-series devices, not just Lua in general.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/helpful_information/list_of_labjack_functions.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/helpful_information/lua_example_style_guide.lua
Helpful tips for programming with Lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/helpful_information/welcome_screen.lua
These examples are specifically written for the T4, even though other scripts also work for the T4 unless otherwise specified.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/t4/spi_loop_back.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/t4/spi_modes_testing.lu
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/t4/t4_basic_io.lua
The examples in this section provide a brief overview of different communication types for external sensors of varying type. Most sensors use digital communication, including 1-wire, SPI, I2C, and UART. A few analog sensor examples are below, although most types of analog sensors are simple enough to be handled by analog input extended features (AIN_EF) or by a program running on a computer.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/1-wire_read_rom_id.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/ds18s20_(1-wire)-advanced.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/ds18b20_temperature_(1-wire).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/adxl345_3-axis_accel_(spi).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/lm34caz_(voltage)-advanced.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/lm34caz_temperature_(voltage).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/ms-360lp_pir_motion_(logic).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/mb1000_range_finder_(pwm).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/ei-1050_temperature_(sbus).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/es08aii_servo_motor_(pwm).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/tp-01_thermocouple_(ain_ef).lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sensor_examples/fgpmmopa6h_adafruit_gps_(uart).lua
The following examples outline how I2C communication can be achieved in Lua scripts.
The below examples utilize the I2C library with the functions built in to the firmware. More detail (at the ModBus register level) can be seen under the I2C Utilities, where the library is exposed as a Lua object with functions. A list of these functions with descriptions can be found here.
The T7 supports Inter-Integrated Circuit (I²C or I2C) communication as the master only. I²C is a synchronous serial protocol typically used to communicate with chips that support I2C as slave devices. More information on I2C can be found here (Wikipedia).
It is recommended to use the EIO or CIO lines for I2C communication on the T7 rather than the FIO lines. For more information on using the T7 with I2C devices, see the T7 Datasheet.
Many sensors can be on the same I2C bus, with very minimal circuitry for each additional I2C device. A total of 7 I2C devices are shown connected to the T7 below, and can all successfully connect and communicate with the T7.
These Lua scripts use the USER_RAM registers to pass data from the Lua script to any other program accessing the T-Series device. LabVIEW, C#, Python, or any other supported languages can access the T-Series device and read from or write to these registers. LJLogM, a LabJack application can be used for easy logging of data from the various sensors.
Q: Why are no I2C ACK bits being received?
Q: I've tried everything, still no I2C Ack Bits...
Q: Why is my device not being found by the I2C.search function?
Q: What are I2C Read and Write functions or procedures?
Q: Why am I getting a I2C_BUS_BUSY (LJM Error code 2720) error?
This Lua Script is an example of how to communicate with an SDP611 differential pressure sensor from Sensirion (datasheet link). Before running this example, connect the SCL line to EIO4 and the SDA line to EIO5.
Note: The default I2C configurations don't work for this sensor. Special configurations are required to account for the "Hold Master" part of the I2C packet.
This example script collects temperature data from the MLX90614 infrared temperature sensor available through Adafruit, SparkFun, Keyestudio, or Pololu.
The data obtained from the non-contact temperature sensor is published to the registers:
These registers can accessed by any programs reading data from a T-Series device collecting this data. This enables any logging or SCADA application to easily collect data from the MLX90614 temperature sensor without any additional complexities.
When getting started with this sensor, the datasheet for this sensor is important to read. There are multiple online tutorials through SparkFun, Adafruit, and more that can serve as supplementary documents. There is also a legacy app-note worth reading Melexis MLX90614 IR Temperature Sensor - I2C (App Note). This sensor has multiple features that allow its slave address to be reprogrammed, enabling multiple IR sensors to exist on the same I2C bus. It can also be enabled for PWM output (not utilized by this application).
Below is a picture of the MLX90614 IR temperature sensor connected to a LabJack with 1.8kΩ resistors installed on a breadboard.
Below is a schematic of the MLX90614 IR Temperature sensor connected to an I2C master MCU. Again, this example used 1.8kΩ resistors.
In this example, the MLX90614 IR Temperature sensor is connected to EIO6 and EIO7. A 3.3V supply was not needed to properly control this sensor. The VS could be 5V while the I/O lines were communicating with 3.3V logic.
After configuring the below example script using Kipling, data can be collected using LJLogM.
This Lua script is useful as an example of how to combine I2C communication between many slave devices. This example utilizes a collection of I2C sensors, which are all available on the Adafruit 10-Degrees of Freedom Inertial Measurement Unit (10-DOF IMU, available here: https://www.adafruit.com/product/1604)
This example uses the following I2C Sensors:
*The BMP180 Barometric Pressure Sensor was not implemented in this example because of Lua script limitations. See the BMP180 Lua script for more information.
**Although the LSM303 devices are in the same package, they behave as two separate devices. See the LSM303 Accelerometer & Magnetometer Lua Script for more information.
Each of the 3 sensors must be initialized over I2C (to configure parameters such as range, data rate, and low/high power mode.
To switch between devices, the I2C bus is configured for one address, and MB.W(5104, 0, yourNewI2CAddress) is used to switch between slave devices. Reconfiguring the bus with I2C.config() would work, but takes unnecessarily long.
For more information on each I2C sensor, visit their specific lua script example.
The 10 DOF board requires very few components to run, a 3.3V supply is provided by the LJTick-LVDigitalIO.
The accelerometer can be tested by rotating it at angles to the earth, where +1.0g and -1.0g can be measured. Below is a graph of the accelerometer data (X is white, Y is red, Z is green) as the module is rotated.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/10dof-adafruit-1604.lua
This script configures the accelerometer inside the LSM303, as well as the magnetometer. These, while in the same package, behave as separate devices with different I2C addresses. The accelerometer can measure acceleration up to ±16g in each axis, and the magnetometer can measure up to 8.1 gauss in each axis. The main purpose of this unit is for a tilt-compensated compass, although it can be used for a variety of functions, depending on the application. The LSM303 on a breakout board is available here: https://www.adafruit.com/product/1120
The data obtained from the accelerometer and magnetometer is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the accelerometer and/or magnetometer data.
The other functionalities of this device, like configurable interrupts, fall detection, and tap detection can be configured just as the other options are configured, although these specialized functions are outside the scope of this example.
Below is the LSM303, as a part of the Adafruit 10DOF board.
The 10 DOF board requires very few components to run, a 3.3V supply is provided by the LJTick-LVDigitalIO.
The accelerometer can be tested by rotating it at angles to the earth, where +1.0g and -1.0g can be measured. Below is a graph of the accelerometer data (X is white, Y is red, Z is green) as the module is rotated.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/accel-and-compass-lsm303dlhc.lua
This script configures the magnetometer inside the LSM303, which behaves as a separate device from the accelerometer that is part of the same unit. The magnetometer can measure acceleration up to ±8.1 gauss in each axis. The main purpose of this unit is for a tilt-compensated compass, although it can be used for a variety of functions, such as free fall detection or tap detection. The LSM303 on a breakout board is available here: https://www.adafruit.com/product/1120
The data obtained from the magnetometer is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the LabJack device simultaneously obtains the magnetometer data.
The datasheet is extremely useful for determining the setting on the device, such as low-power mode and range (±1.3, ±1.9, ±2.5, ±4.0, ±4.7, ±5.6, or ±8.1 gauss)
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/compass-lsm303dlhc.lua
This script configures the accelerometer inside the LSM303, which behaves as a separate device from the magnetometer. The accelerometer can measure acceleration up to ±16g in each axis. The main purpose of this unit is for a tilt-compensated compass, although it can be used for a variety of functions, such as free fall detection or tap detection. The LSM303 on a breakout board is available here: https://www.adafruit.com/product/1120
The data obtained from the accelerometer is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the accelerometer data.
The datasheet is extremely useful for determining the setting on the device, such as low-power mode and range ( ±2g, ±4g, ±8g, or ±16g)
The other functionalities of this device, like configurable interrupts, fall detection, and tap detection can be configured just as the range is configured, although these specialized functions are outside the scope of this example.
Below is the LSM303, as a part of the Adafruit 10DOF board.
The 10 DOF board requires very few components to run, a 3.3V supply is provided by the LJTick-LVDigitalIO.
The accelerometer can be tested by rotating it at angles to the earth, where +1.0g and -1.0g can be measured. Below is a graph of the accelerometer data (X is white, Y is red, Z is green) as the module is rotated.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/accelerometer-lsm303dlhc.lua
This script measures acceleration using the widely available ADXL345 Accelerometer, which can measure acceleration up to 16g on 3 axes. The accelerometer on a breakout board is available here: https://www.sparkfun.com/products/9836
The data obtained from the accelerometer is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the accelerometer data.
The datasheet is extremely useful for determining the setting on the device, such as low-power mode and range (2g, 4g, 8g, or 16g)
The other functionalities of this device, like configurable interrupts, fall detection, and tap detection can be configured just as the range is configured, although these specialized functions are outside the scope of this example.
In the above images, an inexpensive LJTick-LVDigitalIO was used to source the 3.3V needed for the ADXL345. A CB15 was used to expose the EIO4 and EIO5 connections.
Using a python script to read and write to the USER_RAM registers, it was possible to make a self-leveling platform using the ADXL345 and a servo motor.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/accelerometer-adxl345.lua
This script uses the TCS34725 color sensor to determine the color of an object. The breakout board from Adafruit (https://www.adafruit.com/product/1334) has a built-in white LED to illuminate the object. This LED can be controlled by connecting it to a digital pin on the T-series devices. In the below example, FIO6 is used (although the LED pin is not connected in the images)
Information on how to use the values from the sensor can be found on the datasheet. In the example below, color (Simply "Red", "Green", or "Blue") is determined by the most intense color. Specific calculations can be created by the user for specific applications, such as detecting a hue value or the reflectivity of the object. A good understanding of the device's datasheet is important for modifying the script.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/color-sensor-tcs34725.lua
This script records gyroscope data from the L3GD20H Gyro, available here: https://www.adafruit.com/product/1032
The data obtained from the gyroscope is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the gyroscope data.
The datasheet is extremely useful for determining the setting on the device, such as low-power mode and range (±245/±500/±2000 dps)
The other functionalities of this device, like configurable interrupts, sleep mode, and the built-in temperature sensor can be configured just as the range is configured, although these specialized functions are outside the scope of this example.
Below is the gyro as a part of the Adafruit 10 DOF board.
The Gyro is connected to EIO4 and EI5 with pullup resistors. Here, it is using the LJTick-LVDigitalIO to supply the 3.3V necessary.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/gyro-l3gd20h.lua
This script measures rotational speed (degrees per second) using the PS-ITG-3200 Gyroscope, which can measure up to 2000 degrees/sec on 3 axes. The device on a breakout board is available here: https://www.sparkfun.com/products/11977
The data obtained from the gyro is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the gyro data.
The datasheet is helpful for identifying how to initialize the device and how to read data from the gyro.
In the above images, an inexpensive LJTick-LVDigitalIO was used to source the 3.3V needed for the ADXL345. A CB15 was used to expose the EIO4 and EIO5 connections.
The other functionalities of this device, like configurable interrupts, filtering, and other functions are outside the scope of this example, but can easily be configured in the same way the other device settings are initialized.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/gyro-ps-itg-3200.lua
This script communicates with the VL6180 Range Finder I2C sensor. You can find more information on the sensor here: https://www.sparkfun.com/products/12785
This script initializes the slave device with the sI array (see script below) for the proper mode of operation. The application note contains these values on page 24. (https://cdn.sparkfun.com/datasheets/Sensors/Proximity/VL6180_Application...)
The script then reads the distance value from the sensor and reports it to a USER_RAM register, accessible in many other programs, such as LabVIEW, Python, C#, or the LabJack logging software, LJLogM.
The range finder sensor is easily connected using the EB37 and CB15 Accessories.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/proximity-vl6180x.lua
This script measures the distance to a large, flat object up to 255 inches away (21 feet) using the I2C bus. The SRF02 Sensor uses ultrasonic pings to bounce off of large objects and detect the distance.
A register on the SRF02 must be written with the value 0x50 to initiate the ping. After a short delay, the corresponding registers can be read to obtain distance in inches or centimeters. A variety of documentation can be found online regarding the SRF02.
The data obtained from the sensor is published to USER_RAM registers, which can be accessed by any other programs connected to the T-Series device. This allows a program to be doing one task while the device simultaneously obtains the range sensor data.
In the image above, a battery pack is used to supply power to the T7-Pro, and data is acquired over WiFi, allowing the assembly to be moved anywhere within a building while operating.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/ranging-srf02.lua
This script measures temperature and barometric pressure using the BMP180 sensor. The calculations for the BMP180 to take the data and calibration constants and determine the atmospheric pressure is too large for Lua, and is completed through a python script running on a PC instead.
Below is the BMP180 as a part of the Adafruit 10DOF board. A BMP180, with the appropriate passive components, will function identically to the BMP180 on the 10DOF board.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/temp-and-pressure-bmp180.lua
Below is the Python script used to take the calibration constants and print the useful data. It is based off of page 15 of this datasheet.
This script operates an I/O expander over the I2C Bus. The I/O expander- the SX1509- has 16 channels, which can be configured for digital input or output (including PWM and specialized LED driver functions) and can be used to read a keypad.
The breakout board is available here: https://www.sparkfun.com/products/13601
The script below only uses the basic digital input and output functions of this device. This script can be modified to use other functionalities, such as the PWM driver or keypad engine.
USER_RAM registers are read by the script to write values to the digital output lines, and a separate set of USER_RAM register is written to by the script to display the digital input states.
A good understanding of the datasheet and device's functionality is important for understanding and modifying this example.
Before making the decision to use this device, keep in mind that the T7 has 23 DIO lines available.
The EB37 allows for easy prototyping of the entire circuit. The EB37 features a 3.3V regulator, which is being used to supply power to the digital I/O expander. The CB15 provides connection to the EIO lines.
A python script was used to change the USER_RAM registers to sequence through all of the digital output pins, and then write them all high at once.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/io-expander-sx1059.lua
The following examples push the limits of T-Series devices and report maximum frequencies. These examples use different loop structures than most other examples.
You should usually throttle your code execution using the functions:
LJ.IntervalConfig(0, 1000)
and
if LJ.CheckInterval(0) then
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-ain_ef.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-dio.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-dac.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-ain.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-ain_and_pwm.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/speed_test-ain_and_dac.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/low_level_speed_test-dio.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/benchmarking_tests/low_level_speed_test-toggle_led.lua
The following scripts are more advanced in nature than the other examples.
Lua Scripting can be used to implement moving averaging algorithms which allow Modbus polling applications to easily oversample analog inputs and achieve the benefits of higher accuracy analog inputs on low cost devices. This is especially true when the Modbus polling applications are only requesting data once per second. For customer convenience, we have three examples that perform these calculations.
This script reads analog inputs and computes the moving average after each sampling interval. This script is particularly useful for Modbus polling applications that need to be sure that each "moving average" value that gets read is the most up to date value. The script can be customized by editing the constants:
local sampleIntervalHZ = 10 -- Sampling interval in HZ local numSamplesToAverage = 100 -- Number of samples to cached & average local channels = {0, 2} -- Which analog inputs/registers to read & average
To assist with determining maximum sampling rates and buffer sizes, digital I/O lines FIO4-5 on T4s and FIO0-1 on the T7 are configured to output waveforms that can be read with an oscilloscope or logic analyzer. As a really low-cost solution, LEDs can be installed and looked at to see how bright they are and used to determine how much idle time the script has.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/moving_average_compute.lua
This script reads analog inputs and computes the average value of each read channel on a given interval. This is useful for situations where analog inputs want to be read at high data rates. Keep in mind that while a script is computing the average value analog input values aren't being read. In time-critical applications where this is important to characterize and understand, I/O lines can be toggled and monitored with an oscilloscope to determine if the script is reading data fast enough and with low enough jitter.
This script can be customized by editing the sampling interval, number of samples to average, user-ram update rate, and channel register constants.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/moving_average_interval_compute_LS.lua
This script reads analog inputs and computes the average value of each read channel on a given interval. This is useful for situations where analog inputs want to be read at high data rates. Keep in mind that while a script is computing the average value analog input values aren't being read. In time-critical applications where this is important to characterize and understand, I/O lines can be toggled and monitored with an oscilloscope to determine if the script is reading data fast enough and with low enough jitter.
This script can be customized by editing the sampling interval, number of samples to average, user-ram update rate, and channel register constants.
Warning: This script calculates the moving average by maintaining a "sum" which is (in memory) a float32 data type. While the value will remain close to the true value, the precision may slowly drift.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/moving_average_interval_compute_HS.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/pid_example.lua
Stepper motors can be controlled with a LabJack by loading one of the following .lua scripts and executing the python script or our windows only example application written in LabVIEW. For more detail see the Stepper Motor Controller app-note.
This script is meant to be loaded and controlled as part of a larger stepper motor controller application. See the Stepper Motor Controller App-Note for more details.
This script is meant to be loaded and controlled as part of a larger stepper motor controller application. See the Stepper Motor Controller App-Note for more details.
This python script loads and executes a .lua script and then sends data to control the position of the motor. More details about this python script and controlling stepper motors with LabJack T-Series devices can be found in the Stepper Motor Controller app-note.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/write_read_flash.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/zerocrossing_pulse_response.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/lua-stream-and-log-v3.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/task-scheduler_1.0.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/advanced_scripts/waveform-generator_1.0.lua
This section outlines digital I/O extended features in LUA
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/digital_io_ef/high_speed_counter.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/digital_io_ef/pwm_simple.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/digital_io_ef/pwm_library.lua
The examples in this section demonstrate how to make counters, with digital inputs, analog inputs, and debounce. Individual counters can be set to increment on either rising or falling edges.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/counter_examples/23_counters.lua
This example builds upon the 23 Counters example.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/counter_examples/23_counters_with_debounce.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/counter_examples/quadrature_input_large_integers.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/counter_examples/simple_quadrature_input.lua
This example uses the LabJack Mux80 AIN Expansion Board and a minimum of one CB37 Terminal Board, building upon the 37 Counters example.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/counter_examples/107_counters.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/get_device_temperature.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/toggle_dio_1hz.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/set_dio_based_on_voltage.lua
Lua Scripts can be useful for configuring analog inputs on a device both to read them back and to save values as power-up defaults so that devices can be integrated into 3rd party SCADA systems.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/ain_config/ain_config.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/ain_config/ain_config_tc.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/ain_config/ain_ef_config_set_defaults.lua
The following examples demonstrate various uses of the DAC outputs on T-series devices.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/analog_output/output_sine_wave.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/analog_output/output_triangle_wave.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/analog_output/set_dac_based_on_voltage.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/blink_leds.lua
The following examples demonstrate how data can be logged using embedded lua scripts.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/logging/log_voltage_to_file.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/logging/log_voltage_to_file_wifi.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/rtc_and_device_time/num_seconds_since_epoch.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/rtc_and_device_time/print_device_time.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/rtc_and_device_time/rtc_triggered_logging.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/read_ains.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/sleep_function.lua
These examples demonstrate the usage of user RAM registers for communication between a Lua script and host computer.
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/user_ram/lua_io_ram.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/user_ram/user_ram_fifo.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/spi_example.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/uart_example.lua
This example can be found in our Kipling git repository: https://github.com/labjack/labjack_kipling/blob/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/average_min_max.lua
Examples In... | Windows | Mac | Linux |
---|---|---|---|
Dev-C++ | ✔ | ||
LabVIEW | ✔ | ||
Python | ✔ | ✔ | ✔ |
MATLAB | ✔ | ||
Perl | ✔ | ✔ | |
.NET (C#, VB) | ✔ | ||
Delphi | ✔ | ||
VBA Excel | ✔ | ||
Java | ✔ | ||
Visual Basic 6 | ✔ | ||
PowerBASIC | ✔ | ||
Agilent VEE | ✔ | ||
TestPoint | ✔ | ||
Visual C++ OCX | ✔ | ||
Visual C++ DLL | ✔ | ||
LabWindows/CVI | ✔ |
.NET assembly/wrapper (LJDotNet.dll), and C/C++, C# and VB .NET examples for the LabJack U12. Refer to the README.txt file for further information. 2/16/2017, 30KB.
If you are getting errors like "Unable to load "ljackuw.dll"" when running a U12 .NET application or example, download and run the U12 installer to install the U12 driver.
If you are using any LabJacks in the UD series (U3, UE9, U6) use the UD .NET examples instead.
If you are using any LabJacks in the T series (T7) or the Digit use the LJM .NET examples instead.
User submitted U12 Delphi driver. 2/17/2004, 18 KB, submitted by Tim Hughes.
07/09/2010: LabJack support added LJConsole example.
Demonstrates dynamic linking to call U12 functions from Dev-C++. 8/30/2002, 7.5 KB
This is a simple logging program that can write the 8 analog inputs and the 4 IO inputs to file up to 25 times per second.
Running the executable requires previous installation of the LabJack U12 Legacy software package, and opening the LabVIEW source VIs requires the main LabVIEW_U12 archive. Includes executable and LabVIEW 6 source VIs. V1.08, 8/20/2002, 157 KB.
This is a modified version of LJstream configured for 1-channel acquisition, allowing scan rates of 200-1200 Hz.
Running the executable requires previous installation of the LabJack U12 Legacy software package, and opening the LabVIEW source VIs requires the main LabVIEW_U12 archive. Includes executable and LabVIEW 6 source VIs. V1.09, 5/17/2007, 800 KB.
This is a modified version of LJstream configured for 2-channel acquisition, allowing scan rates of 100-600 Hz.
Running the executable requires previous installation of the LabJack U12 Legacy software package, and opening the LabVIEW source VIs requires the main LabVIEW_U12 archive. Includes executable and LabVIEW 6 source VIs. V1.09, 5/17/2007, 800 KB.
LabVIEW is one of, if not the, most popular programming languages used by our customers. LabVIEW is a graphical programming language, as demonstrated in the code snippet below, but understand that it is still a programming language not a simple software tool.
http://www.ni.com/gettingstarted/labviewbasics/
Note that using a LabJack in LabVIEW is not identical to using NI hardware in LabVIEW. The NI hardware is talked to through the NI-DAQ driver, while the U12 is talked to through the LabJack U12 Windows Library. That means that you will not use measurement & automation explorer, DAQ assistant, or similar NI wizards.
The U12 LabVIEW examples are for Windows only.
This example uses 2 calls to the U12 Windows Library:
A short tutorial for how to use the U12 LabVIEW libraries is published on YouTube:
We provide VIs that call all the U12 functions defined in Section 4 of the U12 Datasheet. These VIs are located in a VI library called ljackuw.llb, so if LabVIEW is looking for any of the basic U12 functions point it to the llb file.
If LabVIEW is looking for other sub-VIs, point it to the extracted folder (downloaded below) or perhaps the "sub" folder below that. If the sub-VI is not found there it might be a feature not supported by your version of LabVIEW.
The main U12 installer includes executable versions of LJlogger & LJstream. The source for these is included in the LabVIEW archive attached here, but most users looking to build a custom LabVIEW application should start with one of the simpler examples in the archive, or perhaps LJsimplelog.
You can extract the LabVIEW##_LJU12 archive anywhere, but if you want U12 shortcuts in the LabVIEW function palette (optional) then take the following extra step.
When you extract the LabVIEW##_LJU12 archive (attached below) you will get a folder of the same name with various sub-folders including one called "LabJack" which contains a dir.mnu file (function palette definitions) and ljackuw.llb (a VI library with VIs that call the various U12 Library functions). Move this "LabJack" folder to the \vi.lib\addons\ folder in your LabVIEW directory.
Note that as of September 2016, the main U12 installer no longer includes the LabVIEW examples. Rather they are available below as a separate download.
MATLAB .NET examples for R2009a (7.8) and later
The recommended MATLAB examples that requires R2009a (7.8) and later. The "MATLAB_LJDotNET" attachment below provides examples that use the MATLAB .NET interface and the U12 .NET assembly (LJDotNet.dll). Tested on 32-bit MATLAB 2013a (8.1). Refer to the README.txt in the download for details. 4/11/2013, 6 KB.
Old MATLAB examples for R2008b (7.7) and earlier
Old LabJack U12 drivers for MATLAB. Developed and tested on MATLAB 6.1. The LJMATLAB archive ("Old LJMATLAB" attachment) allows data acquisition and control in MATLAB using the LabJack U12. Requires the normal LabJack U12 Legacy DLL which is installed by the main U12 installer. 4/22/2004, 750 KB.
For MATLAB 5, replace the DLLs from the "Old MATLAB" download (LJMATLAB), with "Old LJMATLAB5" (LJMATLAB5). 4/6/2004, 554 KB.
NOTE: MATLAB 6.5 and higher supports direct DLL calls, so special drivers are not required, but a special header is needed to use some functions (more info).
Device::LabJack drivers for Perl under both Windows and Linux - from CPAN. Submitted by Chris Drake.
Download it here
Our LabJackPython module works with the U12, and as of May 2010 it works on Windows, Linux, and Mac OS X.
Use it like this:
>>> import u12
>>> d = u12.U12()
>>> d.eAnalogIn(0)
{'overVoltage': 0, 'idnum': 12, 'voltage': 1.4599609375}
For more U12 examples visit the Low-Level Function Reference section of the U12 User’s Guide.
LabJack U12 drivers for Agilent VEE. As opposed to actual drivers, this download consists of instructions and examples concerning how to call our existing drivers from VEE. Refer to the README.txt file for further information, and notify us of any comments or problems. 10/16/2003, 29 KB.
Also, one of our German distributors has some more advanced VEE support available. Check out the downloads page at Meilhaus.