Radio Shack Mobile Robot Robotics User Manual


 
Coprocessor Command Summary
continued
34
RC Servo Motor and Steering Motor Control:
Example: !1R380
This command begins with “!1R” and is followed by a character indicating the RC servo motor number
(3 in the example), followed by the position in hexadecimal (80 in the example). Possible position val-
ues are “01” through “FF” which results in about 120 degrees of motion. This varies depending on the
motor. A position value of 80 hexadecimal will center the motor. A position value of “00” will de-
energize the servo motor to conserve power. It normally takes less than one second for the motor to po-
sition itself. During that time, do not de-energize the motor. If the command is accepted, an “A” will be
returned indicating “acknowledged“.
Motor 2 Control (Powerful Output):
Example: !1M20
A second motor control port is provided that can be used to control DC motors or other powerful loads
such as lamps. We refer to this as the Powerful Output. The command begins with “!1M2” and is
followed by a character indicating the action 0=off, 1=forward, 2=reverse. If the command is accepted,
an “A” will be returned indicating “acknowledged“.
Coprocessor Communication Rules
Communication between the Basic Stamp II Master and the coprocessors follow these rules:
Single-wire bidirectional serial communication.
Serial communication parameters: 2400 baud, 8 data bits, and 1 stop bit.
Coprocessor network is a master/slave setup. Slaves only talk when asked to.
Coprocessors never send “!” which is reserved to identify the beginning of a command.
Each command sent by the master begins with “!”.
All commands should be upper case.
Second character of each command is the coprocessor address character. Usually “1”, “2”, etc.
The third character of each command is normally the actual command itself.
Such as “M”, “R”, etc.
Commands are fixed length and do not require carriage returns or other termination.
8-bit values are sent/received using 2 hex digits. 00-FF. 16-bit values are 4 hex digits.
Leading zeros required to maintain fixed length.
Single digit values from 0-9 can be a single character 0-9. Such as motor #, etc.
Commands return a value or return an “A” to indicate “acknowledged”.