LINX Packet Structure
A LINX command packet is variable size and consists of a start of frame (SoF), the packet size (bytes), a 16-bit packet number, a 16-bit command byte, a variable number of argument bytes and a checksum. A LINX packet is limited to 60 bytes total and can contain up to 54 bytes of data. LINX packets are sent MSB first.
|
||||||||||||||||||||||||||||||||
Description | The structure of a generic LINX command packet (sent from LabVIEW). | |||||||||||||||||||||||||||||||
Size | Variable | |||||||||||||||||||||||||||||||
Format | ||||||||||||||||||||||||||||||||
SoF | Start of Frame. Always 0xFF. | |||||||||||||||||||||||||||||||
PACKET SIZE | Total packet size in bytes. | |||||||||||||||||||||||||||||||
PACKET NUM | The Current Packet Number. This value increments with each new packet or repeats for a multi packet command. | |||||||||||||||||||||||||||||||
CMD | The command byte is used to tell the LINX target which operation to perform | |||||||||||||||||||||||||||||||
ARG | Arguments for the given command. Variable length. | |||||||||||||||||||||||||||||||
CHECKSUM | Checksum. Computed by adding all of the bytes in the packet in U8 form ignoring rollover. |
A LINX response packet is sent from the target to LabVIEW. The LINX response packet structure is described below.
|
||||||||||||||||||||||||||||||||
Description | The structure of a generic LINX response packet (sent from LINX target). | |||||||||||||||||||||||||||||||
Size | Variable | |||||||||||||||||||||||||||||||
Format | ||||||||||||||||||||||||||||||||
SoF | Start of Frame. Always 0xFF. | |||||||||||||||||||||||||||||||
PACKET SIZE | Total packet size in bytes. | |||||||||||||||||||||||||||||||
PACKET NUM | The packet number of the packet that generated the response. | |||||||||||||||||||||||||||||||
STATUS | Indicates the target status. This byte is used to return any error generated by the call. | |||||||||||||||||||||||||||||||
DATA | Return data (if any). | |||||||||||||||||||||||||||||||
CHECKSUM | Checksum. Computed by adding all of the bytes in the packet in U8 form ignoring rollover. |
Packet Number
Packet numbering is handled by the host, starting with 0 and increment with each new transaction. Multiple byte transactions will use a single packet number to indicate their grouping. When the target generates a response to a LINX packet the response packet number will match the corresponding command packet number. This could eventually (but will not initially) be used for asynchronous communication. The host will ensure that a response is received for every command packet.