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).
Every LabJack is backed by our free Legendary Support, for life. Additionally, we provide all the software you need to get the most out of your LabJack. Read More
6 comments
Packet description
Hello,
I am currently using the U6 with a raspberry pi2, firmware updated, libusb installed, built C modules and installed wrappers for python. All works.
Still, I have some simple USB routines based on the usb.core python libraries and I would like to send simple sequence of bytes. The have been tested with other devices and they work.
For example, the AIN24 command like:
[0x86,0xF8, 0x03, 0x00, 0x8a, 0x00, 0x00, 0x02, 0x00, 0x08, 0x80, 0x00]
is supposed to read a differential input (channel 0 and 1) with gain index 0 (x1) and precision index 8.
Checksum are verified and received packet is as shown:
[0xCA, 0xF8, 0x03, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x40, 0x04,0x8a]
How should the last bytes be treated to get to a voltage reading?
Thanks
First, take a look at the
First, take a look at the AIN24 low-level documentation. The last 3-bytes in your response is the 24-bit reading as described in the 3-byte response part of that page. Convert those bytes to the 24-bit binary value, and then apply the appropriate calibration constants to get the voltage. So something like this with your response bytes to get the 24-bit value:
binValue = (bytes[11] << 16 ) + (bytes[10] << 8 ) + bytes[9]
For code on getting and applying the calibration contants that converts the binary value reading to a voltage, look at the getCalibrationData and binaryToCalibratedAnalogVoltage methods in the u6.py source code. Also, the Exodriver provides low-level example code which may be helpful.
Questions about Connect by TCP/IP protocol
Hello,
I have a UE9 device. Can I use two programs to read the same UE9 on the same computer?
We do not recommend talking
We do not recommend talking to the device in multiple processes at once unless you have a particularly good reason to. That said, you could connect to the device in two separate processes if you use Ethernet connections. You can only obtain the USB connection in one process at a time, but you should be able to use USB in one program and Ethernet in another.
Ethernet communication
I have a T7, in the past i have experienced some ethernet drop outs. Is there a way to reconnect, programatically if the connection is restored? Right now the device will not until every thing is restarted, including power cycling the T7.
Our LJM library supports
Our LJM library supports connection healing, so you should typically be able to start communicating with the device when the connection is restored. The following page has some recommendations for avioding LJME_RECONNECT_FAILED errors:
https://labjack.com/support/software/api/ljm/ljmereconnectfailed
Another option could be to configure the software watchdog so that the device automatically restarts after a disconnect lasts a certain duration:
https://labjack.com/support/datasheets/t-series/watchdog