EasyManua.ls Logo

LabJack U12 - 5.15 - SHT1 X

LabJack U12
61 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Command
Byte #
Description
0
Data Byte 3
1
Data Byte 2
2
Data Byte 1
3
Data Byte 0
4
Bit 7: Wait for measurement ready signal
Bit 6: Issue serial reset
Bit 5: 1ms Delay
Bit 4: 300ยตs Delay
Bit 3: IO3 State
Bit 2: IO2 State
Bit 1: IO3 Tris (Direction?)
Bit 0: IO2 Tris (Direction?)
5
011X1000 (SHT1X)
6
Number of bytes to write (0-4)
7
Number of bytes to read (0-4)
Response
Byte #
Description
0
Data Byte 3
1
Data Byte 2
2
Data Byte 1
3
Data Byte 0
4
Bit 2: Serial reset error
Bit 1: Measurement ready error
Bit 0: Ack error
5
011X1000 (Echo of byte 5)
6
Echo of byte 6 from Command
7
Echo of byte 7 from Command
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
59

Other manuals for LabJack U12