Skip to main content
Skip table of contents

PortStateWrite: IOType=27

PortStateWrite, 7 Command Bytes:  

0

IOType=27

1-3

WriteMask

4-6

State

0 Response Bytes: 

 

 

This IOType writes the state of all digital I/O, where 0-7=FIO, 8-15=EIO, and 16-19=CIO. The direction of the selected lines is forced to output.

The firmware does the actual updates in the following order: FIO4-5, FIO6-7, FIO0-3, EIO0-5, EIO6-7, CIO0, CIO1, CIO2, CIO3. These all happen within 1 microsecond or so, but EIO0-EIO5, for example, are all updated at the exact same time.

  • WriteMask: Each bit specifies whether to update the corresponding bit of I/O.

  • State: Each bit of this value corresponds to the specified bit of I/O such that 1=High and 0=Low. To set all low, State=d0. To set FIO0-FIO2 high, EIO0-EIO2 high, CIO0 high, and all other I/O low (b000000010000011100000111), State=d67335.

Example

PY
# PortStateWrite Feedback command

import u3
d = u3.U3()
d.debug = True
d.getFeedback(u3.PortStateWrite(State = [0xab, 0xcd, 0xef], WriteMask = [0xff, 0xff, 0xff]))
# Sent:  [0x81, 0xf8, 0x4, 0x0, 0x7f, 0x5, 0x0, 0x1b, 0xff, 0xff, 0xff, 0xab, 0xcd, 0xef]
# Response:  [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
# [None]
JavaScript errors detected

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

If this problem persists, please contact our support.