beautypg.com

E. serial servo commands, Set target (pololu/compact protocol), Set target (mini ssc protocol) – Pololu Maestro User Manual

Page 41

background image

1 0 1 0 0 0 1 0 | | | | | |

1 0 0 0 1 0 0 1 | | | | | |

_______________ | | | | | |

1 0 1 0 1 1 0 0 | | | |

1 0 0 0 1 0 0 1 | | | |

_______________ | | | |

1 0 0 1 0 1 0 0 | |

1 0 0 0 1 0 0 1 | |

_______________ | |

1 1 1 0 1 0 0 = 0x17

So the full command packet we would send with CRC enabled is: 0x83, 0x01, 0x17.

5.e. Serial Servo Commands

The Maestro has several serial commands for setting the target of a channel, getting its current position, and setting
its speed and acceleration limits.

Set Target (Pololu/Compact protocol)

Compact protocol: 0x84, channel number, target low bits, target high bits
Pololu protocol: 0xAA, device number, 0x04, channel number, target low bits, target high bits

The lower 7 bits of the third data byte represent bits 0–6 of the target (the lower 7 bits), while the lower 7 bits of the
fourth data byte represent bits 7–13 of the target. The target is a non-negative integer.

If the channel is configured as a servo, then the target represents the pulse width to transmit in units of quarter-
microseconds. A target value of 0 tells the Maestro to stop sending pulses to the servo.

If the channel is configured as a digital output, values less than 6000 tell the Maestro to drive the line low, while
values of 6000 or greater tell the Maestro to drive the line high.

For example, if channel 2 is configured as a servo and you want to set its target to 1500 µs (1500×4 = 6000 =

0101110

1110000

in binary), you could send the following byte sequence:

in binary: 10000100, 00000010, 0

1110000

, 0

0101110

in hex: 0x84, 0x02, 0x70, 0x2E
in decimal: 132, 2, 112, 46

Here is some example C code that will generate the correct serial bytes, given an integer “channel” that holds the
channel number, an integer “target” that holds the desired target (in units of quarter microseconds if this is a servo
channel) and an array called serialBytes:

serialBytes[0] = 0x84; // Command byte: Set Target.

serialBytes[1] = channel; // First data byte holds channel number.

serialBytes[2] = target & 0x7F; // Second byte holds the lower 7 bits of target.

serialBytes[3] = (target >> 7) & 0x7F; // Third data byte holds the bits 7-13 of target.

Many servo control applications do not need quarter-microsecond target resolution. If you want a shorter and lower-
resolution set of commands for setting the target you can use the Mini-SSC command below.

Set Target (Mini SSC protocol)

Mini-SSC protocol: 0xFF, channel address, 8-bit target

This command sets the target of a channel to a value specified by an 8-bit target value from 0 to 254. The 8-bit target
value is converted to a full-resolution target value according to the range and neutral settings stored on the Maestro

Pololu Maestro Servo Controller User's Guide

© 2001–2014 Pololu Corporation

5. Serial Interface

Page 41 of 73