minimum command packet (single command with no data) is 11 bytes long
and consists of the following fields:.
Table 1. Command packet structure
Start
Char
Space
Address
Space
Command
Space
Checksum
Terminator
1 byte 1 byte 2 bytes
1 byte
2 bytes
1 byte
2 bytes
1 byte
Field
Size
Comment
1. START Character
1 character (byte)
ASCII character is ‘~’ (TILDA)
Start is the first byte in the command packet and tells remote controllers to start
decoding a message. It should be implemented as a #define, so it can be changed if
necessary. As a #define, the character is rarely changed because it is hard coded into
the SPCe.
<SPACE>
2. ADDRESS
2 hex characters
Range 00 through FF
This field should be filled in with the hexadecimal representation of the integer address
of the controller. The range provides 255 unique addresses. Only 32 devices may reside
on the same serial port due to hardware loading limitations.
<SPACE>
3. COMMAND CODE
2 hex characters
Range 00 through FF
This field is one of 255 possible hexadecimal numbers, which is typically an index into a
table of functions on the remote controller. Commands should be implemented as
#defines with integers between 0 and 255. The integer value must be converted into
ASCII hex before placement into the command packet character array. The command
code must be two hex digits, even if the first is a zero.
<SPACE>
4. DATA fields (optional)
As needed
ASCII printable characters only
Data field(s) are for any commands that have a data value. For instance, a command to
set a beam voltage in some unit would probably consist of a command to set the beam
voltage, along with a value of beam voltage. If the command had more than one data
value associated with it, such as setting an X and a Y value in a unit, the command field
could be followed by two data fields (X and Y) separated by a space between them. All
data must be sent in ASCII printable format (no binary or "control" characters). There is
no limit on the number or size of data fields. It is up to the remote unit designer to keep
practicality in mind when determining these fields. A data field is not required for all
commands.
<SPACE>
5. CHECKSUM
2 hex characters
Computed checksum of packet
The calculated checksum must have its value in ASCII hexadecimal notation. It is
calculated by adding the decimal value of all characters in the packet (excluding start,
checksum, and terminator), and then dividing the result by 256. The integer remainder
converted to two ASCII hex digits is the checksum. When a remote device receives a
packet, the passed checksum is compared with a computed checksum, and if they do
not match, the device discards the packet.
04/2021 - ©Gamma
Page 40
900026_F
900026_F - Serial (J3) and ethernet (J2) operation