This commands reads the direction and state of all the digital I/O. If Update Digital = 1, this function also sets the directions and states before reading.
Table 5.2-1.
|
Command |
|
|
Byte # |
Description |
|
0 |
Bits for D15 through D8 Direction ( 0 = Output, 1 = Input) |
|
1 |
Bits for D7 through D0 Direction ( 0 = Output, 1 = Input) |
|
2 |
Bits for D15 through D8 State ( 0 = Low, 1 = High) |
|
3 |
Bits for D7 through D0 State ( 0 = Low, 1 = High) |
|
4 |
Bits 7-4: Bits for IO3 through IO0 Direction |
|
|
Bits 3-0: Bits for IO3 through IO0 State |
|
5 |
01X10111 (DIO) |
|
6 |
Bits 7-1: XXXXXXX |
|
|
Bit 0: Update Digital |
|
7 |
XXXXXXXX |
|
|
|
|
Response |
|
|
Byte # |
Description |
|
0 |
01X10111 (DIO Response) |
|
1 |
Bits for D15 through D8 State ( 0 = Low, 1 = High) |
|
2 |
Bits for D7 through D0 State ( 0 = Low, 1 = High) |
|
3 |
Bits 7-4: Bits for IO3 through IO0 State |
|
|
Bits 3-0: XXXX |
|
4 |
Bits for D15 through D8 Direction ( 0 = Output, 1 = Input) |
|
5 |
Bits for D7 through D0 Direction ( 0 = Output, 1 = Input) |
|
6 |
Bits for D15 through D8 Output Latch States |
|
7 |
Bits for D7 through D0 Output Latch States |
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.rawDIO()
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
{
'D7toD0States':
<BitField object: [ D7 = Low (0), D6 = Low (0),
D5 = Low (0), D4 = Low (0),
D3 = Low (0), D2 = Low (0),
D1 = Low (0), D0 = Low (0) ] >,
'IO3toIO0States':
<BitField object: [ IO3 = Low (0), IO2 = Low (0),
IO1 = Low (0), IO0 = Low (0) ] >,
'D15toD8Directions':
<BitField object: [ D15 = Input (1), D14 = Input (1),
D13 = Input (1), D12 = Input (1),
D11 = Input (1), D10 = Input (1),
D9 = Input (1), D8 = Input (1) ] >,
'D7toD0OutputLatchStates':
<BitField object: [ D7 = 0 (0), D6 = 0 (0),
D5 = 0 (0), D4 = 0 (0),
D3 = 0 (0), D2 = 0 (0),
D1 = 0 (0), D0 = 0 (0) ] >,
'D15toD8OutputLatchStates':
<BitField object: [ D15 = 0 (0), D14 = 0 (0),
D13 = 0 (0), D12 = 0 (0),
D11 = 0 (0), D10 = 0 (0),
D9 = 0 (0), D8 = 0 (0) ] >,
'D15toD8States':
<BitField object: [ D15 = Low (0), D14 = Low (0),
D13 = Low (0), D12 = Low (0),
D11 = Low (0), D10 = Low (0),
D9 = Low (0), D8 = Low (0) ] >,
'D7toD0Directions':
<BitField object: [ D7 = Input (1), D6 = Input (1),
D5 = Input (1), D4 = Input (1),
D3 = Input (1), D2 = Input (1),
D1 = Input (1), D0 = Input (1) ] >
}