Binary Socket
D20980.022 Rev C
CV-LS User Manual
Page 82
Encoding a Packet
All binary commands have the following key Byte Values:
Byte Name
Value
Start
0x12
Escape
0x7D
End
0x13
A command has the following structure:
1)
2 Byte Command
a)
Bits 1-12: Command Code
b)
Bit 13: Read when 0, Write when 1
c)
Bits 14-15: Command Set
2)
2 Byte Data Length (number of bytes in Data Payload)
3)
Data Payload
4)
2 Byte Flecher16 Checksum
Once the command is constructed, the data must be escaped. Any byte in the entire packet that
matches the
Start
,
Escape
, or
End
bytes must have the
Escape
byte added just before it. The byte must
then have a bitwise XOR with 0x80 applied. This ensures that no byte in the entire payload will match
the
Start
or
End
bytes.
Once the command is escaped, a
Start
byte is prepended to the packet, and a
Stop
byte is apended to
the packet.
This process creates a single complete packet, and can then be transmitted to the Binary Socket. If a
packet does not follow this form, it will be discarded by the unit.
Note:
An example implimentation of this method can be found in the “classBinarySocket.c” file in the
Dashboard source code.
Decoding a Packet
Decoding a stream of data from the unit can be done by reversing the process of “Encoding a Packet”.
The Dashboard Application implements an asynchronous approach to decoding packets. This is the
preferred method to make use of the streaming status functions available to the Binary Socket.
Commands
Please download the programming guide, found under the
Error! Reference source not found.
Section
on page 94, for a full list of available commands and how to use them.
Содержание ColdVision
Страница 36: ...D20980 022 Rev C CV LS User Manual Page 36 LED LED UV UV LED RMA 91...
Страница 38: ...D20980 022 Rev C CV LS User Manual Page 38 1 SCHOTT SCHOTT machine vision moritex com...
Страница 42: ...D20980 022 Rev C CV LS User Manual Page 42 LED LED UV UV LED Return Material Authorization RMA 91...
Страница 44: ...D20980 022 Rev C CV LS User Manual Page 44 SCHOTT SCHOTT machine vision moritex com...