Skip to main content
Skip table of contents

5.1 - AISample [U12 Datasheet]

This function reads from 4 analog inputs. It can also toggle the status LED and update the state of the IOs.

Table 5.1-1.

Command

 

Byte #

Description

0

Bit 7: X

 

Bits 6-4: PGA for 1st Channel

 

Bits 3-0: MUX command for 1st Channel.

1

Bit 7: X

 

Bits 6-4: PGA for 2nd Channel

 

Bits 3-0: MUX command for 2nd Channel.

2

Bit 7: X

 

Bits 6-4: PGA for 3rd Channel

 

Bits 3-0: MUX command for 3rd Channel.

3

Bit 7: X

 

Bits 6-4: PGA for 4th Channel

 

Bits 3-0: MUX command for 4th Channel.

4

Bits 7-2: XXXXXX

 

Bit 1: Update IO

 

Bit 0: LED State

5

Bit 7-4: 1100 (Command/Response)

 

Bit 3-0: Bits for IO3 through IO0 States

6

XXXXXXXX

7

Echo Value

 

 

 

 

Response

 

Byte #

Description

0

Bit 7: 1

 

Bit 6: 0

 

Bit 5: X

 

Bit 4: PGA Overvoltage

 

Bits 3-0: Bits for IO3 through IO0 States

1

Echo byte 7 from Command

2

Bits 7-4: Most Significant Bits from 1st Channel

 

Bits 3-0: Most Significant Bits from 2nd Chanel

3

Least Significant Byte from 1st Channel

4

Least Significant Byte from 2nd Channel

5

Bits 7-4: Most Significant Bits from 3rd Channel

 

Bits 3-0: Most Significant Bits from 4th Chanel

6

Least Significant Byte from 3rd Channel

7

Least Significant Byte from 4th Channel

  • PGA Gain Setting – (Differential Only) 0b000 = 1, 0b001 = 2, 0b010 = 4, 0b100 = 8, 0b101 = 10, 0b110 = 16, 0b111 = 20

  • Mux Settings – 0b0000 = 0-1 (Differential), 0b0001 = 2-3 (Differential), 0b0010 = 4-5 (Differential), 0b0011 = 6-7 (Differential). Single-Ended readings = 0b1000 + AI Number.

LabJackPython Example

>>> import u12
>>> d = u12.U12(debug=True)
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> d.rawAISample()
Writing: [0x8, 0x9, 0xa, 0xb, 0x1, 0xc0, 0x0, 0x0]
Received: [0x80, 0x0, 0x99, 0xb, 0x28, 0x99, 0x2c, 0x5]
{
'IO3toIO0States':
<BitField object: [ IO3 = Low (0), IO2 = Low (0),
IO1 = Low (0), IO0 = Low (0) ] >,
'Channel1': 1.4453125,
'Channel3': 1.2744140625,
'Channel2': 1.46484375,
'PGAOvervoltage': False,
'Channel0': 1.3037109375,
'EchoValue': 0
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.