beautypg.com

E. motor control commands, Motor off – Pololu Jrk USB User Manual

Page 31

background image

2. Add 7 zeros to the end of your message.

3. Write your CRC-7 polynomial underneath the message so that the LSB of your polynomial is directly below
the LSB of your message.

4. If the LSB of your CRC-7 is aligned under a 1, XOR the CRC-7 with the message to get a new message; if
the LSB of your CRC-7 is aligned under a 0, do nothing.

5. Shift your CRC-7 right one bit. If all 8 bits of your CRC-7 polynomial still line up underneath message bits,
go back to step 4.

6. What’s left of your message is now your CRC-7 result (transmit these seven bits as your CRC byte when
talking to the jrk with CRC enabled).

If you have never encountered CRCs before, this probably sounds a lot more complicated than it really is. The
following example shows that the CRC-7 calculation is not that difficult. For the example, we will use a two-byte
sequence: 0x83, 0x01.

Steps 1 & 2 (write as binary, add 7 zeros to the end of the message):

CRC-7 Polynomial = [1 0 0 0 1 0 0 1]

message = [1 1 0 0 0 0 0 1] [1 0 0 0 0 0 0 0] 0 0 0 0 0 0 0

Steps 3, 4, & 5:

_______________________________________________

1 0 0 0 1 0 0 1 ) 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

XOR 1 0 0 0 1 0 0 1 | | | | | | | | | | | | | | |

--------------- | | | | | | | | | | | | | | |

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

shift ----> 1 0 0 0 1 0 0 1 | | | | | | | | | | | | | |

_______________ | | | | | | | | | | | | | |

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

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

_______________ | | | | | | | | | | |

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

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

_______________ | | | | | | | | | |

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

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

_______________ | | | | | | |

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.

4.e. Motor Control Commands

The jrk has several serial commands for turning the motor on and off and setting the target. These commands are
mainly intended to be used in serial input mode, but they can be used in any input mode to turn the motor on or off
from a computer.

Motor Off

Compact protocol: 0xFF
Pololu protocol: 0xAA, device number, 0x7F

Pololu Jrk USB Motor Controller User's Guide

© 2001–2014 Pololu Corporation

4. Using the Serial Interface

Page 31 of 45