Argument strings, Termination characters, Responses – Pololu Simple User Manual

Page 72

Advertising
background image

Command String Command Name

“GO”

Exit Safe-Start

“F”

Motor Forward

“R”

Motor Reverse

“B”

Motor Brake

“D”

Get Variable

“L”

Set Motor Limit

“V”

Get Firmware Version

“X”

Stop Motor

Argument Strings

Command arguments are expressed as strings of ASCII digits. By default, the string is interpreted as a decimal (base
10) value, but an “H” can be appended to the end of the string to tell the Simple Motor Controller to interpret it as a
hexadecimal (base 16, or hex) value. For example, you can represent an argument value of 127 with “127” or “7FH”
(0x7F is the hex representation of 127). The arguments to the three motor commands (“F”, “R”, and “B”) can also
be written as percentages by appending a “%” to the end of the argument. For example, you can represent full motor
speed with the argument “3200” or with the argument “100%”.

Termination Characters

ASCII mode accepts three different termination characters:

Carriage Return: A carriage return is the character sent when you press the Enter key in a terminal program.
It is often written as <CR> and has a character value of 13. In C, this special character can be written as ‘\r’.

NL Line Feed: Also known as “new line”, this character is often written as <LF> and has a character value
of 12. In C, this special character can be written as ‘\n’.

Null Character: This character is used to terminate strings in C. It is often written as <NUL> and has a
character value of 0. In C, the string “abc” is comprised of the four characters: ‘a’, ‘b’, ‘c’, and <NUL>.

One of the above three characters must be the last character in your ASCII command string.

Responses

Any ASCII mode command string that contains more than just a termination character will generate a serial response
from the Simple Motor Controller. The first character of the response gives you information about the status of the
Simple Motor controller; it can be one three possible characters:

Status Character Meaning

‘.’

The last command was understood and no errors are stopping the motor.

‘!’

The last command was understood and errors are stopping the motor.

‘?’

The last command was not understood (a Serial Format Error has occurred).

If the command sent responds with data (e.g. the Get Variable command), the data follows the status character as a
decimal (base 10) string of ASCII digits.

Pololu Simple Motor Controller User's Guide

© 2001–2014 Pololu Corporation

6. Using the Serial Interface

Page 72 of 101

Advertising