PortDirRead: IOType=28
PortDirRead, 1 Command Byte: | |
0 | IOType=28 |
|
|
3 Response Bytes: | |
0-2 | Direction |
This IOType reads the directions of all digital I/O, where 0-7=FIO, 8-15=EIO, and 16-19=CIO. These are the digital directions only, and do not provide any information as to whether the lines are configured as digital or analog.
Direction: Each bit of this value corresponds to the specified bit of I/O such that 1=Output and 0=Input. If all are input, Direction=d0. If all 20 standard digital I/O are output, Direction=d1048575. If FIO0-FIO2 are output, EIO0-EIO2 are output, CIO0 are output, and all other I/O are input (b000000010000011100000111), Direction=d67335.
Example
# PortDirRead Feedback command
# Reads the direction of all digital I/O.
import u3
d = u3.U3()
d.debug = True
d.getFeedback(u3.PortDirRead())
# Sent: [0x16, 0xf8, 0x1, 0x0, 0x1c, 0x0, 0x0, 0x1c]
# Response: [0xfb, 0xf8, 0x3, 0x0, 0xfe, 0x1, 0x0, 0x0, 0x0, 0xf0, 0xff, 0xf]
# [{'CIO': 15, 'FIO': 240, 'EIO': 255}]