beautypg.com

D. 0x83 & 0x84: get & set configuration parameter, Command 0x83 (131): get configuration parameter, Command 0x84 (132): set configuration parameter – Pololu Qik 2s12v10 User Manual

Page 24

background image

computed as that packet’s CRC. In such a case, the qik ignores the command packet and generates a CRC
error. See

Section 6

for more information on cyclic redundancy checking.

bit 6:

Format Error

This error occurs when the qik receives an incorrectly formatted or nonsensical command packet. For
example, if the command byte does not match a known command, data bytes are outside of the allowed range
for their particular command, or an unfinished command packet is interrupted by another command packet,
this bit is set.

bit 7:

Timeout

It is possible to use a configuration parameter to enable the qik’s serial timeout feature (see

Section 5.a

).

When enabled, the qik sets this bit if the timeout period set by the configuration parameter has elapsed. The
timeout timer is reset every time a command packet is received. A timeout error can be used to shutdown the
motors in the event that serial communication between the qik and its controller is disrupted.

In response to an error, the qik lights the red status LED and drives the ERR pin high until this command is called.
Calling this command clears the error byte, turns the red status LED off, and sets the ERR pin to high-impedance
(the error LED pulls it low). The shut-down-on-error configuration parameter can be used to stop motors M0 and
M1 as a safety precaution when a serial error occurs, a motor-fault error occurs, or a motor-over-current error
occurs. See

Section 5.a

for more information on this configuration parameter.

5.d. 0x83 & 0x84: Get & Set Configuration Parameter
Command 0x83 (131):

Get Configuration Parameter

Compact protocol: 0x83, parameter number
Pololu protocol: 0xAA, device ID, 0x03, parameter number

This command lets you request the current value of any of the twelve configuration parameters detailed in

Section

5.a

. This command prompts the qik to transmit a single byte that represents the requested parameter value. If you

request an invalid parameter (i.e. if parameter number ≥ 12), the value transmitted by the qik (typically 0xFF) has
no meaning and a format error is generated.

Command 0x84 (132):

Set Configuration Parameter

Compact protocol: 0x84, parameter number, parameter value, 0x55, 0x2A
Pololu protocol: 0xAA, device ID, 0x04, parameter number, parameter value, 0x55, 0x2A

This command lets you set the value of any of the twelve configuration parameters detailed in

Section 5.a

. The

final two bytes of the command packet—0x55 (85) and 0x2A (42)—are format bytes that make it more difficult
for this command to be accidentally sent, as might result from a noisy serial connection or buggy user code. If
either of the format bytes differs from the expected value, the command is ignored and a format error is generated.

It takes the qik approximately 4 ms to finish processing this command, at which point the qik transmits a single
return byte that contains information about whether the process was successful. You should not send commands
to the qik until you have received this return byte, or until at least 4 ms have elapsed. The return byte can have the
following values:

0: Command OK (

success

)

1: Bad Parameter (

failure due to invalid parameter number

)

2: Bad value (

failure due to invalid parameter value for the specified parameter number

)

Failure results in a format error.

Qik 2s12v10 User's Guide

© 2001–2012 Pololu Corporation

5. Serial Parameters and Commands

Page 24 of 33