Bedienungsanleitung XZ-R1 IFS
Seite 21
Ver. 1.0
3.2. Serial packet format
Byte
Value
Description
0x00
0xFF
header
0x01
0x55
packet ID (serial stream)
0x02
0xXXXX
Channel mask high byte (bits
15-8)
0x03
0xXXXX
Channel mask low byte (bits
7-0)
0x04
0xXXXX
Servo pulse high byte (bits 15-
8)
0x05
0xXXXX
Servo pulse low byte (bits 7-0)
... repeat for each servo
channel until done
0x??
0xXXXX
CRC of channel data.
The CRC is the last byte of the packet. It is a simple 8 bit checksum calculated using the
following formula:
( PACKET ID + MASKH + MASKL + each byte of channel data) XOR 0xFF.
3.3. 16 bit MASK Definition
Bit:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Channel: 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
A set bit in the mask represents that the servo channel is present in the data that is being
transferred. For example, if the mask is 0x01FF then it means that channels 1, 2, 3, 4, 5, 6, 7, 8,
and 9 will be appearing (sequentially) in the stream. If the mask is 0x17F then it means channels
1, 2, 3, 4, 5, 6, 7, and 9 will appearing in the stream. Notice channel 8 (bit 7) is missing.
Channels are always output in sequential order starting with the lowest channel number first.
An example packet outputting 3 channels (1/2/3) would be:
0xFF,0x55,0x00,0x07,0x05,0xDC,0x05,0xDC,0x05,0xDC,0x01
The checksum is calculated by adding the 10 packet bytes together (which adds up to be
0x3FE), ignoring the upper byte leaves (0xFE). That value XOR’d with 0xFF equals 0x01, which
is the checksum.
The channel data represents the servo position in 1us steps. In the above example, the channel
data is 0x05DC, which is 1500 in decimal. 1500us is typical servo center. The range allowed is
750us to 2250us (0x2EE to 0x8CA).
During a loss of signal, no data is transferred via the serial bus for that frame.