Skip to Navigation

U12

Everything tagged "U12"

ljacklm driver

The high-level U12 driver for Linux and Mac OS X.  The ljacklm driver is a port of the ljackuw Windows driver and contains the same functions documented in Section 4 of the U12 User's Guide, excluding Windows specific functions such as GetWinVersion.  The driver requires the Exodriver version 2.05 or above before installation.  The Exodriver web page and download can be found here:

Exodriver

The ljacklm.zip package contains the ljacklm driver's source code, installation instructions and C example code.  For more details on the driver and the contents of the package, please refer to the README in the zip.

 

File attachment: 

Comments

No comments yet. Speak up. We're listening.

Comments

No comments yet. Speak up. We're listening.

Comments

No comments yet. Speak up. We're listening.

Comments

No comments yet. Speak up. We're listening.

Comments

No comments yet. Speak up. We're listening.

U12 Support in LabJackPython and the Exodriver

We’re happy to announce support for the U12 in our new Linux and Mac OS X driver, the Exodriver. Now, bundled with the Exodriver is a quick example showing how to work with the U12 in C.

While C is just fine, we prefer Python programming. The U12 Python module in LabJackPython has been expanded significantly to support all of the low-level functions (documented in Section 5) when using the Exodriver. Windows users will continue to use the UW driver functions documented in Section 4.

We liked the new Python interface so much, you’ll see that Section 5 has been updated with example code from LabJackPython. If you’re programming in another language these examples are a great way to see exactly what bytes are sent between a PC and a U12.

Mac OS X please note: There is a bug in libusb that prevents the Exodriver from communicating with the U12. Here is the thread on the libusb-dev mailing list made suggestions to improve the support on Mac OS X. We’ll continue to track libusb development for changes.

tags:

5.15 - SHT1X

Sends and receives data from a SHT1X T/RH sensor from Sensirion.

Baud rate without delay is about 2 kpbs.

DATA is IO0, SCK is IO1

Enable is not handled by this function.

LabJackPython Example

  
>>> import u12
>>> d = u12.U12()
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> results = d.rawSHT1X()
Writing: [0x0, 0x0, 0x0, 0x3, 0x8f, 0x68, 0x1, 0x3]
Received: [0x0, 0x66, 0x34, 0x19, 0x0, 0x68, 0x1, 0x3]
>>> print results
{
  'DataByte3': 0, 'DataByte2': 102, 'DataByte1': 52, 'DataByte0': 25, 
  'ErrorFlags': 
    <BitField object: [ Serial Reset Error Flag = 0 (0), 
                        Measurement Ready Error Flag = 0 (0), 
                        Ack Error Flag = 0 (0) ] >}
>>> tempC = (results['DataByte0'] * 256 ) + results['DataByte1']
>>> tempC = (tempC * 0.01) - 40
>>> print tempC
24.52
>>> results = d.rawSHT1X(Data = [5,0,0,0])
Writing: [0x0, 0x0, 0x0, 0x5, 0x8f, 0x68, 0x1, 0x3]
Received: [0x0, 0xaa, 0xae, 0x2, 0x0, 0x68, 0x1, 0x3]
>>> print results
{
  'DataByte3': 0, 'DataByte2': 170, 'DataByte1': 174, 'DataByte0': 2, 
  'ErrorFlags': 
    <BitField object: [ Serial Reset Error Flag = 0 (0), 
                        Measurement Ready Error Flag = 0 (0), 
                        Ack Error Flag = 0 (0) ] >}
>>> sorh = (results['DataByte0'] * 256 ) + results['DataByte1']
>>> rhlinear = (-0.0000028*sorh*sorh)+(0.0405*sorh)-4.0
>>> rh = ((tempC-25.0)*(0.01+(0.00008*sorh)))+rhlinear
>>> print rh
22.4341888
  
tags:

Comments

No comments yet. Speak up. We're listening.

5.14 - SPI

Sends and receives data synchronously (SPI). First four bytes sent/received are passed in this call, and copied to the first 4 bytes of RAM buffer (first 4 bytes of RAM transmit buffer are never used). Any additional bytes must be written/read with the RAM. Baud rate with no delay is about 160 kpbs.

LabJackPython Example

  
>>> import u12
>>> d = u12.U12()
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> d.rawSPI([1,2,3,4], NumberOfBytesToWriteRead = 4)
Writing: [0x4, 0x3, 0x2, 0x1, 0x1, 0x62, 0x4, 0x0]
Received: [0x4, 0x3, 0x2, 0x1, 0x1, 0x62, 0x4, 0x0]
{
  'DataByte3': 4, 'DataByte2': 3, 'DataByte1': 2, 'DataByte0': 1, 
  'ErrorFlags': 
    <BitField object: [ CSStateTris Error Flag = 0 (0), 
                        SCKTris Error Flag = 0 (0), 
                        MISOTris Error Flag = 0 (0), 
                        MOSITris Error Flag = 1 (1) ] >
}
  
tags:

Comments

No comments yet. Speak up. We're listening.

5.13 - Asynch

Sends data asynchronously, then receives data. First four bytes sent or received are passed in this call, and copied to the first 4 bytes of RAM buffer (first 4 bytes of RAM transmit buffer are never used). Any additional bytes must be written/read with the RAM. Baud rate and timeout period must be set by writing to the proper RAM locations. Timeout in milliseconds is about 100*tomult.

LabJackPython Example

  
>>> import u12
>>> d = u12.U12()
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> # Set the full and half A,B,C to 9600
>>> d.rawWriteRAM([0, 1, 1, 200], 0x073)
Writing: [0xc8, 0x1, 0x1, 0x0, 0x0, 0x51, 0x0, 0x73]
Received: [0x51, 0xc8, 0x1, 0x1, 0x0, 0x0, 0x0, 0x73]
{'DataByte3': 200, 'DataByte2': 1, 'DataByte1': 1, 'DataByte0': 0}
>>> d.rawWriteRAM([5, 1, 2, 48], 0x076)
Writing: [0x30, 0x2, 0x1, 0x5, 0x0, 0x51, 0x0, 0x76]
Received: [0x51, 0x30, 0x2, 0x1, 0x5, 0x0, 0x0, 0x76]
{'DataByte3': 48, 'DataByte2': 2, 'DataByte1': 1, 'DataByte0': 5}
>>> d.rawAsynch([1, 2, 3, 4], NumberOfBytesToWrite = 4, NumberOfBytesToRead = 4)
Writing: [0x4, 0x3, 0x2, 0x1, 0x0, 0x61, 0x4, 0x4]
Received: [0x4, 0x3, 0x2, 0x1, 0x1, 0x61, 0x4, 0x4]
{
  'DataByte3': 4, 'DataByte2': 3, 'DataByte1': 2, 'DataByte0': 1, 
  'ErrorFlags': 
    <BitField object: [ Timeout Error Flag = 0 (0), 
                        STRT Error Flag = 0 (0), 
                        FRM Error Flag = 0 (0), 
                        RXTris Error Flag = 0 (0), 
                        TETris Error Flag = 0 (0), 
                        TXTris Error Flag = 1 (1) ] >
}
  
tags:

Comments

No comments yet. Speak up. We're listening.

5.12 - Write RAM

Writes 4 bytes to the U12’s internal memory.

Note: Bytes are written down from the starting address. For example, if you write starting at address 0x203, then byte 0 is written to 0x203, byte 1 is written to 0x202, byte 2 is written to 0x201, and byte 0 is written to 0x200.

LabJackPython Example

  
>>> import u12
>>> d = u12.U12()
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> d.rawWriteRAM([1, 2, 3, 4], 0x200)
Writing: [0x4, 0x3, 0x2, 0x1, 0x0, 0x51, 0x2, 0x0]
Received: [0x51, 0x4, 0x3, 0x2, 0x1, 0x0, 0x2, 0x0]
{'DataByte3': 4, 'DataByte2': 3, 'DataByte1': 2, 'DataByte0': 1}
  
tags:

Comments

No comments yet. Speak up. We're listening.