Buffer Commands
All Buffer Commands must be prefaced by BUF[n]
, where n is the index of the internal buffer. The Binho Multi-Protocol USB Host Adapter features just one internal buffer, therefore the only valid value for n at this time is n=0.
CLEAR
Clears the contents of the entire 256-byte buffer.
Parameters:
This function takes no parameters.
Response:
This function returns an ACK Response after clearing the buffer.
Example Usage:
ADD
Adds a single byte of data into the buffer and increments the pointer index by +1.
Add value to buffer: BUF[n] ADD [data]
Parameters:
This function takes one parameter, data. This is the 8-bit unsigned integer (byte) value that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after adding the byte the buffer if the command succeeds. If an invalid parameter is provided, the function will return a NAK Response.
Example Usage:
WRITE
Writes n bytes of data into the buffer, up to a maximum of 32 bytes at a time.
Add n bytes into the buffer beginning at startIndex: BUF[n] WRITE [startIndex] [data_0] [data_1] ... [data_n]
Parameters:
startIndex is the 8-bit integer index of the location that the first byte should be written to the buffer.
data_n is the 8-bit integer (byte) that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after writing the data into the buffer if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
READ
Reads n bytes of data from the buffer beginning at the start of the buffer, up to a maximum of 256 bytes at a time (the entire buffer).
BUF[n] READ [byteCount]
Parameters:
byteCount is the 8-bit integer number of bytes to read from the buffer. Valid range is from 1 to 256 bytes.
Response:
This function returns a Data Response if the read command was successful. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
Last updated