User Guide

Checksum
To prevent data corruption, each packet is terminated with a checksum. If the checksum is not
correct, the data packet will not be acted upon. The checksum is calculated as follows:
Checksum = address byte + command byte + data byte
The checksum should be added with all unsigned 8 bit integers, and then ANDed with the mask
0b01111111 (decimal 127) in an 8 bit system.
Example of Packetized Serial
The following is an example function for commanding two Dimension Engineering motor
drivers using Packetized Serial Mode. Figure 7.3 shows an example hookup and Figure 7.4
shows an example function.
void DriveForward(char address, char speed)
{
Putc(address);
Putc(0);
Putc(speed);
Putc((address + 0 + speed) & 127);
}
Figure 7.3: Packetized serial hookup Figure 7.4: Packetized Serial Function
Example: So in this function, if address is 130, command is 0 (for driving forward), speed is 64,
the checksum should calculate as follows:
130+0+64 = 194
194 in binary is 0b11000010
0b11000010 & 0b01111111 = 0b01000010
Once all the data is sent, this will result in the Sabertooth with address 130 driving forward at
roughly half throttle.
Emergency Stop
In Packetized Serial mode, the S2 input is configured as an active-low emergency stop. It is
pulled high internally, so if this feature isn’t needed, it can be ignored. If an emergency stop is
desired, all the S2 inputs can be tied together. Pulling the S2 input low will cause the driver to
shut down. This should be tied to an emergency stop button if used in a device that could
endanger humans.