Port Receive

Response Code:

Binary: [p2 p1 p0 l4 l3 l2 l1 l0] [byte 1] [byte 2] … [byte L]


Data received on the specified port.

Bits l4:l0 form the number L which indicates the length of the  message received in bytes. The L bytes following the command contain the message. The values L=0 and L=31 are reserved for the port send end and port modify messages respectively.

IR port messages are sent in a run length coded format while S-Link and Parallel Port messages are sent in a raw binary format. To allow messages of arbitrary size to be sent by the Slink-e to the host computer, multiple port receive commands may be sent in succession.  In order to indicate the end of a received port message, a port receive end command will always be sent at the end of a complete message. Note that Slink-e can receive data from all ports simultaneously. This means that port receive responses from multiple ports may become interleaved. That is, port receive responses may come from multiple ports before their respective port receive end responses are sent. For example, a 14 byte S-Link message from port 0 followed by a 2 byte S-Link message from port 2 may cause a Slink-e response which looks like this:

[PR P=0 L=8] [byte1] ... [byte8] [PR P=0 L=6] [byte1] ... [byte6] [PRE P=0] [P=2 L=2] [byte1] [byte2] [PRE P=2]

However, if the port 2 message occurs during the middle of the port 0 message, the following response may occur:

[PR P=0 L=8] [byte1] ... [byte8] [PR P=2 L=2] [byte1] [byte2] [PRE P=2] [PR P=0 L=6] [byte1] ... [byte6] [PRE P=0]

As you can see, it is necessary for the user's program to buffer the data from each port separately until the port receive end response for that port is sent. See the code examples for a proper implementation.

Additional notes:

On Slink-e V2.0 and later, a last received port equals response is sent after every received IR message (i.e. after the IR port receive end). This is used to indicate which IR port the message was received on.