to control the servos and obtain
feedback information.
One of the first things that you
should do to test to see if you have
bi-directional serial communications
established with the servo is to read
the servo firmware and ID number
using command 0xE7. To do this, send
the following five bytes of data to the
servo: 0x80, 0xE7, 0x00, 0x00, 0x99.
You should receive the following two
bytes of data back: 0x6E and 0x00. The
decimal equivalent of 0x6E is 110
which is firmware version 1.10. 0x00 is
the default servo ID number. Unless it
has been previously changed, it should
be zero.
To command a servo to move to a
specific target position, the servo ID
number serves as the move command.
The target position is in milliseconds,
much like the regular pulse width
commands. Since the position range is
typically between 600 and 2,400 ms, it
is always greater than 256 ms, thus the
target position becomes a 16 bit word.
This needs to be broken down into
two separate bytes of data to be
transmitted to the servo. The following
two equations show how to break the
target position down into the two
bytes of data:
High_Byte = INT(Target_Position/256)
Low_Byte = (Target_Position) MOD 256
For example, to tell the servo to
move to the 1,500 ms neutral position,
the following set of data is sent to the
servo: 0x80, 0x00, 0x05, 0xDC, 0x9F.
The 0x80 is the header, 0x00 is the
servo ID number, 0x05 and 0xDC are
the high and low bytes of the 1,500 ms
target position, and the 0x9F is the
Checksum. Once this command is sent,
the servo will immediately begin to
move to that position.
To change the speed of the servo,
the 0xE9 command is used. The first
parameter sent to the servo is the servo
ID number, and the second parameter
is the speed. The speed command
appears to be more like a percentage
between 0 and 100%. The servo’s
speed doesn’t get any faster for numbers greater than 100. This command
will also return the current position of
the servo. Again, the position is broken
down into two bytes of data that can
be recombined into a single value with
the following formula:
Position = (High_Byte * 256) +
Low_Byte
The HSR servos can be daisy-chained together so that one serial
data communication line can be used
to control all of the servos connected
to that line. If the servos are wired this
way, then the above two commands
(setting the position, velocity, and
position feedback) are the only
commands that will address a specific
servo, by its ID number. The rest of the
commands address all of the servos at
the same time.
Thus, if you want to address all of
the features of the servos, they will
need to be individually wired to the
microcontroller. This is true for servo
firmware version 1.10. New firmware
versions may change this.
Another command for setting the
servo’s target position is 0xE6. If the
servo’s motion has been stopped using
Command
Param1
Param2
Return1
Return2
Description
ID
Position High_Byte Position Low_Byte
0x00
0x00
Position command for servo #ID
0xE1
Address
0x00
Data
0x03
Read EEPROM
0xE2
Address
0x00
0x03
0x03
Write EEPROM
0xE3
Address
0x00
Data
0x03
Read memory
0xE4
Address
0x00
0x03
0x03
Write memory
0xE5
0x00
0x00
Position High_Byte Position Low_Byte
Read position
0xE6
Position High_Byte Position Low_Byte
0x00
0x00
0xE7
0x00
0x00
Version
ID
Position command
Read firmware version
and servo #ID
0xE8
0x00
0x00
Current
Voltage
Read current draw and voltage
0xE9
ID
Speed
Position High_Byte Position Low_Byte
0xEA
0x00
1, 2, or 3
0x03
0x06
0xEB
0x00
0 or 1
0x03
0x06
Set the speed of servo #ID
and read position
Select servo performance
group number
Stop or restart servo motion
0xEF
0x00
0x00
0x03
0x06
Release servo from serial control
0xF6
Position High_Byte Position Low_Byte
0x33 or 0x63
0xFB or 0xFF
Position command for all servos
ID (Servo ID number) Valid Range: 0x00 to 0x7F, Default: 0x00
Table 2. Servo command set.
18 SERVO 01.2008