User’s Manual 2007-03-27
Closer to Real,
Dynamixel RX-28
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
1. Dynamixel RX-28
1-1. Overview and Characteristics of RX-28
Dynamixel RX-28
The Dynamixel series robot actuator is a smart, modular actuator that incorporates a
gear reducer, a precision DC motor and a control circuitry with networking functionality,
all in a single package. Despite its compact size, it can produce high torque and is
made with high quality materials to provide the necessary strength and structural
resilience to withstand large external forces. It also has the ability to detect and act
upon internal conditions such as changes in internal temperature or supply voltage.
The Dynamixel RX-28 has many advantages over similar products.
Precision Control
Position and speed can be controlled with a resolution of 1024 steps.
Compliance Driving The degree of compliance can be adjusted and specified in controlling position.
Feedback
Feedback for angular position, angular velocity, and load torque are available.
Alarm System
The Dynamixel series robot actuator can alert the user when parameters deviate from
user defined ranges (e.g. internal temperature, torque, voltage, etc) and can also handle
the problem automatically (e.g. torque off)
Communication
Wiring is easy with daisy chain connection, and it support communication speeds up to
1M BPS.
Distributed Control
Position, velocity, compliance, and torque can be set with a single command packet,
thus enabling the main processor to control many Dynamixel units even with very few
resources.
Engineering Plastic
Axis Bearing
Status LED
The main body of the unit is made with high quality engineering plastic which enables it
to handle high torque loads.
A bearing is used at the final axis to ensure no efficiency degradation with high external
loads.
The LED can indicate the error status to the user.
Frames
A hinge frame and a side mount frame are supported by option.
2
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
1-2. Main Specifications
RX-28
72
Weight (g)
Gear Reduction Ratio
Input Voltage (V)
1/193
at 12V
at 16V
37.7
Final Max Holding Torque(kgf.cm)
Sec/60degree
28.3
0.167
0.126
Resolution
0.3°
Operating Angle
Voltage
300°, Endless Turn
12V~16V (Recommended voltage: 14.4V)
1200mA
Max. Current
Operate Temperature
Command Signal
Protocol Type
Link (Physical)
ID
-5℃ ~ +85℃
Digital Packet
RS485 Asynchronous Serial Communication (8bit,1stop,No Parity)
RS485 Multi Drop Bus
254 ID (0~253)
Communication Speed 7343bps ~ 1 Mbps
Feedback
Material
Motor
Position, Temperature, Load, Input Voltage, etc.
Full Metal Gear, Engineering Plastic
Maxon RE-MAX
3
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
2. Dynamixel Operation
2-1. Mechanical Assembly
Option Frames
OF-28B
OF-28S
RXOF-28H
Horn-28T
4
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Assembly
Sample assembly using option frames.
2-2 . Connector Assembly
Assemble the connectors as shown below. Attach the wires to the terminals using the
correct crimping tool. If you do not have access to a crimping tool, solder the terminals to
the wires to ensure that they do not become loose during operation.
5
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
2-3. Dynamixel Wiring
Pin Assignment
The connector pin assignments are as the following. The two connectors on the
Dynamixel are connected pin to pin, thus the RX-28 can be operated with only one
connector attached.
( Note : The pin number of connector’s edge cut side is PIN1)
PIN1: GND
PIN4: D-
PIN3: D+
PIN2: VDD(12V~21V)
PIN3: D+
PIN2: VDD(12V~21V)
PIN1: GND
PIN4: D-
Wiring
Connect the RX-28 actuators pin to pin as shown below. Many RX-28 actuators can be
controlled with a single bus in this manner.
Control Box “CM-2
Main Controller
To operate the Dynamixel actuators, the main controller must support RS485 UART. A
proprietary controller can be used, but the use of the Dynamixel controller CM-2 PLUS is
recommended.
6
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Connection to UART To control the Dynamixel actuators, the main controller needs to convert its UART
signals to the RS485 type. The recommended circuit diagram for this is shown below.\
CCW
VDD
The power is supplied to the Dynamixel actuator from the main controller through Pin 1
and Pin 2 of the Molex3P connector. (The circuit shown above is presented only to
explain the use of RS485 UART. The CM-2 PLUS controller already has the above
circuitry built in, thus the Dynamixel actuators can be directly connected to it)
The direction of data signals on the TTL level TxD and RxD depends on the
DIRECTION485 level as the following.
• When the DIRECTION485 level is High: the signal TxD is output as D+, D-
• When the DIRECTION485 level is Low: the signal D+, D- is input as RxD
RS485 UART
A multi-drop method of connecting multiple Dynamixel actuators to a single node is
possible by using the RS485 UART. Thus a protocol that does not allow multiple
transmissions at the same time should be maintained when controlling the Dynamixel
actuators.
Main
Controller
[Multi Drop Link]
7
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Caution
Please ensure that the pin assignments are correct when connecting the Dynamixel
actuators. Check the current consumption when powering on. The current consumption
of a single Dynamixel actuator unit in standby mode should be no larger than 50mA
Connection Status Verification
When power is applied to the Dynamixel actuator, the LED blinks twice to confirm its
connection.
Inspection
If the above operation was not successful, then check the connector pin assignment and
the voltage/current limit of the power supply.
8
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
3. Communication Protocol
3-1. Communication Overview
Packet
The main controller communicates with the Dynamixel units by sending and receiving
data packets. There are two types of packets; the “Instruction Packet” (sent from the
main controller to the Dynamixel actuators) and the “Status Packet” (sent from the
Dynamixel actuators to the main controller.)
Instruction Packet
Main
Controller
Status Packet
Communication
For the system connection below, if the main controller sends an instruction packet with
the ID set to N, only the Dynamixel unit with this ID value will return its respective status
packet and perform the required instruction.
Instruction Packet(ID=N)
Main
Controller
ID=0
ID=1
ID=N
Status Packet(ID=N)
Unique ID
Protocol
If multiple Dynamixel units have the same ID value, multiple packets sent
simultaneously collide, resulting in communication problems. Thus, it is imperative that
no Dynamixel units share the same ID in a network node.
The Dynamixel actuators communicate through asynchronous serial communication
with 8 bit, 1 stop bit and no parity.
9
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
3-2. Instruction Packet
The Instruction Packet is the packet sent by the main controller to the Dynamixel units
to send commands. The structure of the Instruction Packet is as the following.
OXFF 0XFF ID LENGTH INSTRUCTION PARAMETER1 …PARAMETER N CHECK SUM
The meanings of each packet byte definition are as the following.
The two 0XFF bytes indicate the start of an incoming packet.
Instruction Packet
0XFF 0XFF
ID
The unique ID of a Dynamixel unit. There are 254 available ID values, ranging from
0X00 to 0XFD.
Broadcasting ID
ID 0XFE is the Broadcasting ID which indicates all of the connected Dynamixel units.
Packets sent with this ID apply to all Dynamixel units on the network. Thus packets sent
with a broadcasting ID will not return any status packets.
LENGTH
The length of the packet where its value is “Number of parameters (N) + 2”
The instruction for the Dynamixel actuator to perform.
INSTRUCTION
PARAMETER0…N
CHECK SUM
Used if there is additional information needed to be sent other than the instruction itself.
The computation method for the ‘Check Sum’ is as the following.
Check Sum = ~ (ID + Length + Instruction + Parameter1 + ... Parameter N)
If the calculated value is larger than 255, the lower byte is defined as the checksum
value.
~ represents the NOT logic operation.
3-3. Status Packet(Return Packet)
The Status Packet is the response packet from the Dynamixel units to the Main
Controller after receiving an instruction packet. The structure of the status packet is as
the following.
OXFF 0XFF ID LENGTH ERROR PARAMETER1 PARAMETER2…PARAMETER N CHECK SUM
10
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
The meanings of each packet byte definition are as the following.
The two 0XFF bytes indicate the start of the packet.
0XFF 0XFF
ID
The unique ID of the Dynamixel unit returning the packet. The initial value is set to 1.
The length of the packet where its value is “Number of parameters (N) + 2”
LENGTH
ERROR
The byte representing errors sent from the Dynamixel unit. The meaning of each bit is
as the following.
Bit
Name
0
Details
-
Bit 7
Set to 1 if an undefined instruction is sent or an action
instruction is sent without a Reg_Write instruction.
Set to 1 if the specified maximum torque can't control the
applied load.
Bit 6
Bit 5
Bit 4
Bit 3
Instruction Error
Overload Error
Checksum Error Set to 1 if the checksum of the instruction packet is incorrect.
Range Error
Set to 1 if the instruction sent is out of the defined range.
Set to 1 if the internal temperature of the Dynamixel unit is
above the operating temperature range as defined in the
control table.
Overheating
Error
Bit 2
Set as 1 if the Goal Position is set outside of the range
between CW Angle Limit and CCW Angle
Limit.
Angle Limit
Error
Bit 1
Bit 0
Input Voltage
Error
Set to 1 if the voltage is out of the operating voltage range as
defined in the control table.
PARAMETER0…N
CHECK SUM
Used if additional information is needed.
The computation method for the ‘Check Sum’ is as the following.
Check Sum = ~ (ID + Length + Instruction + Parameter1 + ... Parameter N)
If the calculated value is larger than 255, the lower byte is defined as the checksum
value. ~ represents the NOT logic operation.
11
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
3-4. Control
Table
Address
0(0X00)
Item
Model Number(L)
Access
RD
Initial Value
28(0x1C)
0(0x00)
?
1(0X01)
Model Number(H)
Version of Firmware
ID
RD
2(0X02)
RD
3(0X03)
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
-
1(0x01)
34(0x22)
250(0xFA)
0(0x00)
0(0x00)
255(0xFF)
3(0x03)
0(0x00)
85(0x55)
60(0X3C)
240(0xF0)
255(0XFF)
3(0x03)
2(0x02)
4(0x04)
4(0x04)
0(0x00)
?
4(0X04)
Baud Rate
5(0X05)
Return Delay Time
CW Angle Limit(L)
CW Angle Limit(H)
CCW Angle Limit(L)
CCW Angle Limit(H)
(Reserved)
6(0X06)
7(0X07)
8(0X08)
9(0X09)
10(0x0A)
11(0X0B)
12(0X0C)
13(0X0D)
14(0X0E)
15(0X0F)
16(0X10)
17(0X11)
18(0X12)
19(0X13)
20(0X14)
21(0X15)
22(0X16)
23(0X17)
24(0X18)
25(0X19)
26(0X1A)
27(0X1B)
28(0X1C)
29(0X1D)
30(0X1E)
31(0X1F)
32(0X20)
33(0X21)
34(0X22)
35(0X23)
36(0X24)
37(0X25)
38(0X26)
39(0X27)
40(0X28)
41(0X29)
42(0X2A)
43(0X2B)
44(0X2C)
45(0X2D)
46[0x2E)
47[0x2F)
48[0x30)
49[0x31)
the Highest Limit Temperature
the Lowest Limit Voltage
the Highest Limit Voltage
Max Torque(L)
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD
EEPROM
Area
Max Torque(H)
Status Return Level
Alarm LED
Alarm Shutdown
(Reserved)
Down Calibration(L)
Down Calibration(H)
Up Calibration(L)
Up Calibration(H)
Torque Enable
RD
?
RD
?
RD
?
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD,W R
RD
0(0x00)
0(0x00)
0(0x00)
0(0x00)
32(0x20)
32(0x20)
[Addr36]value
[Addr37]value
0
LED
CW Compliance Margin
CCW Compliance Margin
CW Compliance Slope
CCW Compliance Slope
Goal Position(L)
Goal Position(H)
Moving Speed(L)
Moving Speed(H)
Torque Limit(L)
Torque Limit(H)
Present Position(L)
Present Position(H)
Present Speed(L)
Present Speed(H)
Present Load(L)
Present Load(H)
Present Voltage
Present Temperature
Registered Instruction
(Reserved)
0
[Addr14] value
[Addr15] value
?
RAM
Area
RD
?
RD
?
RD
?
RD
?
RD
?
RD
?
RD
?
RD,W R
-
0(0x00)
0(0x00)
0(0x00)
0(0x00)
32(0x20)
0(0x00)
Moving
RD
Lock
RD,W R
RD,W R
RD,W R
Punch(L)
Punch(H)
12
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Control Table
The Control Table contains information on the status and operation of the Dynamixel
actuator. The Dynamixel actuator is operated by writing values to its control table and its
status is checked by reading values off its control table.
RAM and EEPROM
Initial Value
The data values for the RAM area will be set to the default initial values whenever the
power is turned on. However, the data values for the EEPROM area are non-volatile
and will still remain even after the power is turned off.
The Initial Value column on the right side of the control table shows the Factory Default
Values for the case of EEPROM area data, and shows the initial value when the power
is turned on for the case of RAM area data.
The following explains the meaning of data stored in each of the addresses in the
control table.
Address 0x00,0x01
Address 0x02
Model Number.
For RX-28, this value is 0X001C (28).
Firmware Version.
Address 0x03
ID. The unique ID number assigned to each Dynamixel actuators for identifying them.
Different IDs are required for each Dynamixel actuators that are on the same network.
Address 0x04
Baud Rate. Determines the communication speed. The computation is done by the
following formula.
Speed (BPS) = 2000000 / (Address4 + 1)
Data Value for each Major Baud Rate
Adress4
Hex
0X01
0X03
0X04
0X07
0X09
0X10
0X22
0X67
0XCF
Set BPS
1000000.0
Goal BPS
1000000.0
Error
1
3
4
7
9
16
34
103
207
0.000%
0.000%
0.000%
0.000%
0.000%
-2.124%
0.794%
-0.160%
-0.160%
500000.0
400000.0
250000.0
200000.0
117647.1
57142.9
19230.8
9615.4
500000.0
400000.0
250000.0
200000.0
115200.0
57600.0
19200.0
9600.0
Note
A maximum Baud Rate error of 3% is within the tolerance of UART communication.
The initial value of Baudrate is set to 34(57600bps)
Caution
13
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Address 0x05
Return Delay Time. The time it takes for the Status Packet to return after the Instruction
Packet is sent. The delay time is given by 2uSec * Address5 value.
Address 0x06,0x07,0x08,0x09
Operating Angle Limit. Sets the Dynamixel actuator’s operating angle range. The Goal
Position needs to be within the range of: CW Angle Limit <= Goal Position <= CCW
Angle Limit. An Angle Limit Error will occur if the Goal Position is set outside this range
set by the operating angle limits.
Address 0x0B
the Highest Limit Temperature. The upper limit of the Dynamixel actuator’s operating
temperature. If the internal temperature of the Dynamixel actuator gets higher than this
value, the Over Heating Error Bit (Bit 2 of the Status Packet) will return the value 1, and
an alarm will be set by Address 17, 18. The values are in Degrees Celsius.
Address 0x0C,0x0D
the Lowest (Highest) Limit Voltage. The upper and lower limits of the Dynamixel
actuator’s operating voltage. If the present voltage (Address 42) is out of the specified
range, a Voltage Range Error Bit (Bit 0 of the Status Packet) will return the value 1,
and an alarm will be set by Address 17, 18. The values are 10 times the actual voltage
value. For example, if the Address 12 value is 80, then the lower voltage limit is set to
8V.
Address 0x0E,0x0F, 0x22,0x23
Max Torque. The maximum torque output for the Dynamixel actuator. When this value
is set to 0, the Dynamixel actuator enters the Free Run mode. There are two locations
where this maximum torque limit is defined; in the EEPROM (Address 0X0E, 0x0F) and
in the RAM (Address 0x22, 0x23). When the power is turned on, the maximum torque
limit value defined in the EEPROM is copied to the location in the RAM. The torque of
the Dynamixel actuator is limited by the values located in the RAM (Address 0x22,
0x23).
Address 0X10
Status Return Level. Determines whether the Dynamixel actuator will return a Status
Packet after receiving an Instruction Packet.
Address16
Returning the Status Packet
Do not respond to any instructions
Respond only to READ_DATA instructions
Respond to all instructions
0
1
2
14
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
In the case of an instruction which uses the Broadcast ID (0XFE) the Status Packet will
not be returned regardless of the Address 0x10 value.
Address 0X11
Alarm LED. If the corresponding Bit is set to 1, the LED blinks when an Error occurs.
Bit
Function
Bit 7
0
Bit 6 If set to 1, the LED blinks when an Instruction Error occurs
Bit 5 If set to 1, the LED blinks when an Overload Error occurs
Bit 4 If set to 1, the LED blinks when a Checksum Error occurs
Bit 3 If set to 1, the LED blinks when a Range Error occurs
Bit 2 If set to 1, the LED blinks when an Overheating Error occurs
Bit 1 If set to 1, the LED blinks when an Angle Limit Error occurs
Bit 0 If set to 1, the LED blinks when an Input Voltage Error occurs
This function operates following the “OR” logical operation of all bits. For example, if the
value is set to 0X05, the LED will blink when an Input Voltage Error occurs or when an
Overheating Error occurs. Upon returning to a normal condition from an error state, the
LED stops blinking after 2 seconds.
Address 0X12
Alarm Shutdown. If the corresponding Bit is set to a 1, the Dynamixel actuator’s torque
will be turned off when an error occurs.
Bit
Function
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
If set to 1, torque off when an Instruction Error occurs
If set to 1, torque off when an Overload Error occurs
If set to 1, torque off when a Checksum Error occurs
If set to 1, torque off when a Range Error occurs
If set to 1, torque off when an Overheating Error occurs
If set to 1, torque off when an Angle Limit Error occurs
If set to 1, torque off when an Input Voltage Error occurs
This function operates following the “OR” logical operation of all bits. However, unlike
the Alarm LED, after returning to a normal condition, it maintains the torque off status.
To recover, the Torque Enable (Address0X18) needs to be reset to 1.
Address 0x14~0x17
Calibration. Data used for compensating for the differences between the
potentiometers used in the Dynamixel units. The user cannot change this data.
The following (from Address 0x18) is in the RAM area.
15
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Address 0x18
Torque Enable. When the power is first turned on, the Dynamixel actuator enters the
Torque Free Run condition (zero torque). Setting the value in Address 0x18 to 1 enables
the torque.
Address 0x19
LED. The LED turns on when set to 1 and turns off if set to 0.
Address 0x1A~0x1D Compliance Margin and Slope. The compliance of the Dynamixel actuator is defined
by setting the compliance Margin and Slope. This feature can be utilized for absorbing
shocks at the output shaft. The following graph shows how each compliance value
(length of A, B, C & D) is defined by the Position Error and applied torque.
Goal Position
CW
E
E
CW
CCW
X axis:Position Error
CCW
Y axis:Output Torque
A
B
C
D
A : CCW Compliance Slope(Address0x1D)
B : CCW Compliance Margin(Address0x1B)
C : CW Compliance Margin(Address0x1A)
D : CW Compliance Slope (Address0x1C)
E : Punch(Address0x30,31)
Address 0X1E,0x1F Goal Position Requested angular position for the Dynamixel actuator output to move to.
Setting this value to 0x3ff moves the output shaft to the position at 300°.
150°
(Goal Position = 0x1ff)
CCW
CW
300°
(Goal Position = 0x3ff)
0°
(Goal Position = 0)
300~360°
Invalid Angle
16
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Address 0x20,0x21
Moving Speed. Sets the angular velocity of the output moving to the Goal Position.
Setting this value to its maximum value of 0x3ff moves the output with the maximum
angular velocity which depends on the level of power supplied and Dynamixel series.
(The lowest velocity is when this value is set to 1. When set to 0, the velocity is the
largest possible for the supplied voltage, e.g. no velocity control is applied.)
Address 0x24,0x25
Address 0x26,0x27
Address 0x28,0x29
Present Position. Current angular position of the Dynamixel actuator output.
Present Speed. Current angular velocity of the Dynamixel actuator output.
Present Load. The magnitude of the load on the operating Dynamixel actuator. Bit 10 is
the direction of the load.
BIT
15~11
0
10
9
8
7
6
5
4
3
2
1
0
Value
Load Direction
Load Value
Load Direction = 0 : CCW Load, Load Direction = 1: CW Load
Address 0x2A
Address 0x2B
Address 0x2C
Present Voltage. The voltage currently applied to the Dynamixel actuator. The value is
10 times the actual voltage. For example, 10V is represented as 100 (0x64).
Present Temperature. The internal temperature of the Dynamixel actuator in Degrees
Celsius.
Registered Instruction. Set to 1 when an instruction is assigned by the REG_WRITE
command. Set to 0 after it completes the assigned instruction by the Action command.
Address 0x2E
Address 0x2F
Moving. Set to 1 when the Dynamixel actuator is moving by its own power.
Lock. If set to 1, only Address 0x18 to 0x23 can be written to and other areas cannot.
Once locked, it can only be unlocked by turning the power off.
Address 0x30,0x31
Endless Turn
Punch. The minimum current supplied to the motor during operation. The initial value is
set to 0x20 and its maximum value is 0x3ff.
If both values for the CW Angle Limit and the CCW Angle Limit are set to 0, an Endless
Turn mode can be implemented by setting the Goal Speed. This feature can be used for
implementing a continuously rotating wheel.
17
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Goal Speed Setting
BIT
15~11
10
9
8
7
6
5
4
3
2
1
0
Value
0
Turn Direction
Speed Value
Turn Direction = 0 : CCW Direction Turn, Load Direction = 1: CW Direction Turn
Range
Each data has a valid minimum and maximum values. Write instructions made outside
of these valid ranges will return an error. The following table summarizes the data range
for each register. 16 bit data registers are indicated with two bytes (L) and (H). Both
bytes need to be written at the same time as one instruction packet.
Write
Address
Length
(bytes)
Writing Item
Min
Max
3(0X03)
4(0X04)
ID
1
1
1
2
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
2
0
253(0xfd)
254(0xfe)
254(0xfe)
1023(0x3ff)
1023(0x3ff)
150(0x96)
250(0xfa)
250(0xfa)
1023(0x3ff)
2
Baud Rate
0
5(0X05)
Return Delay Time
CW Angle Limit
CCW Angle Limit
the Highest Limit Temperature
the Lowest Limit Voltage
the Highest Limit Voltage
Max Torque
0
6(0X06)
0
8(0X08)
0
11(0X0B)
12(0X0C)
13(0X0D)
14(0X0E)
16(0X10)
17(0X11)
18(0X12)
19(0X13)
24(0X18)
25(0X19)
26(0X1A)
27(0X1B)
28(0X1C)
29(0X1D)
30(0X1E)
32(0X20)
34(0X22)
44(0X2C)
47(0X2F)
48(0X30)
0
50(0x32)
50(0x32)
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
Status Return Level
Alarm LED
127(0x7f)
127(0x7f)
1
Alarm Shutdown
(Reserved)
Torque Enable
1
LED
1
CW Compliance Margin
CCW Compliance Margin
CW Compliance Slope
CCW Compliance Slope
Goal Position
254(0xfe)
254(0xfe)
254(0xfe)
254(0xfe)
1023(0x3ff)
1023(0x3ff)
1023(0x3ff)
1
Moving Speed
Torque Limit
Registered Instruction
Lock
1
Punch
1023(0x3ff)
[Control Table Data Range and Length for Writing]
18
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
4. Instruction Set and Examples
The following Instructions are available.
Number of
Parameter
Instruction
PING
Function
Value
0x01
No action. Used for obtaining a Status Packet
0
2
READ DATA
Reading values in the Control Table
0x02
0x03
0x04
0x05
W RITE DATA W riting values to the Control Table
2 ~
2 ~
0
Similar to W RITE_DATA, but stays in standby
REG W RITE
mode until the ACION instruction is given
Triggers the action registered by the
ACTION
REG_W RITE instruction
Changes the control table values of the
RESET
Dynamixel actuator to the Factory Default Value 0x06
settings
0
Used for controlling many Dynamixel actuators
at the same time
SYNC W RITE
0x83
4~
4-1. WRITE_DATA
Function
To write data into the control table of the Dynamixel actuator
N+3 (N is the number of data to be written)
0X03
Length
Instruction
Parameter1
Parameter2
Parameter3
Parameter N+1
Starting address of the location where the data is to be written
1st data to be written
2nd data to be written
Nth data to be written
Example 1
Setting the ID of a connected Dynamixel actuator to 1
Write 1 to address 3 of the control table. The ID is transmitted using the Broadcasting ID
(0xFE).
19
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Instruction Packet : 0XFF 0XFF 0XFE 0X04 0X03 0X03 0X01 0XF6`
ID LENGTH INSTRUCTION PARAMETERS CHECKSUM
Because it was transmitted with a Broadcast ID (0XFE), no status packets are returned.
4-2. READ_DATA
Function
Read data from the control table of a Dynamixel actuator
Length
0X04
Instruction
Parameter1
Parameter2
0X02
Starting address of the location where the data is to be read
Length of the data to be read
Example 2
Reading the internal temperature of the Dynamixel actuator with an ID of 1
Read 1 byte from address 0x2B of the control table.
Instruction Packet : 0XFF 0XFF 0X01 0X04 0X02 0X2B 0X01 0XCC`
ID LENGTH INSTRUCTION PARAMETERS . CHECKSUM
The returned Status Packet will be as the following.
Status Packet : 0XFF 0XFF 0X01 0X03 0X00 0X20 0XDB
ID LENGTH ERROR PARAMETER1 CHECKSUM
The data read is 0x20. Thus the current internal temperature of the Dynamixel actuator
is approximately 32°C (0X20).
20
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
4-3. REG_WRITE과 ACTION
4-3-1. REG_WRITE
Function
The REG_WRITE instruction is similar to the WRITE_DATA instruction, but the
execution timing is different. When the Instruction Packet is received the values are
stored in the Buffer and the Write instruction is under a standby status. At this time, the
Registered Instruction register (Address 0x2C) is set to 1. After the Action Instruction
Packet is received, the registered Write instruction is finally executed.
Length
N+3 (N is the number of data to be written)
0X04
Instruction
Parameter1
Parameter2
Parameter3
Parameter N+1
Starting address of the location where the data is to be written
1st data to be written
2nd data to be written
Nth data to be written
4-3-2. ACTION
Function
Length
Triggers the action registered by the REG_WRITE instruction
0X02
0X05
NONE
Instruction
Parameter
The ACTION instruction is useful when multiple Dynamixel actuators need to move
simultaneously. When controlling multiple Dynamixel actuator units, slight time delays
can occur between the 1st and last units to receive an instruction. The Dynamixel
actuator handles this problem by using the ACTION instruction.
Broadcasting
The Broadcast ID (0XFE) is used when sending ACTION instructions to more than two
Dynamixel actuators. Note that no packets are returned by this operation.
21
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
4-4. PING
Function
Does not command any operations. Used for requesting a status packet or to check the
existence of a Dynamixel actuator with a specific ID.
Length
0X02
0X01
NONE
Instruction
Parameter
Example 3
Obtaining the status packet of the Dynamixel actuator with an ID of 1
Instruction Packet : 0XFF 0XFF 0X01 0X02 0X01 0XFB`
ID LENGTH INSTRUCTION CHECKSUM
The returned Status Packet is as the following
Status Packet : 0XFF 0XFF 0X01 0X02 0X00 0XFC
ID LENGTH ERROR CHECKSUM
Regardless of whether the Broadcasting ID is used or the Status Return Level (Address
16) is 0, a Status Packet is always returned by the PING instruction.
4-5. RESET
Function
Changes the control table values of the Dynamixel actuator to the Factory Default Value
settings
0X02
Length
Instruction
Parameter
0X06
NONE
Example 4
Resetting the Dynamixel actuator with an ID of 0
Instruction Packet : 0XFF 0XFF 0X00 0X02 0X06 0XF7`
ID LENGTH INSTRUCTION CHECKSUM
22
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
The returned Status Packet is as the following
Status Packet : 0XFF 0XFF 0X00 0X02 0X00 0XFD
ID LENGTH ERROR CHECKSUM
Note the ID of this Dynamixel actuator is now changed to 1 after the RESET instruction.
4-6. SYNC WRITE
Function
Used for controlling many Dynamixel actuators at the same time. The communication
time decreases by the Synch Write instruction since many instructions can be
transmitted by a single instruction. However, you can use this instruction only when the
lengths and addresses of the control table to be written to are the same. Also, the
broadcasting ID needs to be used for transmitting.
ID
0XFE
Length
(L + 1) * N + 4 (L: Data length for each Dynamixel actuator, N: The number of Dynamixel
actuators)
Instruction
Parameter1
Parameter2
Parameter3
Parameter4
Parameter5
…
0X83
Starting address of the location where the data is to be written
The length of the data to be written (L)
The ID of the 1st Dynamixel actuator
The 1st data for the 1st Dynamixel actuator
The 2nd data for the 1st Dynamixel actuator
Data for the 1st Dynamixel actuator
Parameter L+3
The Lth data for the 1st Dynamixel actuator
Parameter L+4
Parameter L+5
Parameter L+6
…
The ID of the 2nd Dynamixel actuator
The 1st data for the 2nd Dynamixel actuator
The 2nd data for the 2nd Dynamixel actuator
Data for the 2nd Dynamixel actuator
Parameter 2L+4
….
The Lth data for the 2nd Dynamixel actuator
Example 5
Setting the following positions and velocities for 4 Dynamixel actuators
Dynamixel actuator with an ID of 0: to position 0X010 with a speed of 0X150
Dynamixel actuator with an ID of 1: to position 0X220 with a speed of 0X360
23
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Dynamixel actuator with an ID of 2: to position 0X030 with a speed of 0X170
Dynamixel actuator with an ID of 0: to position 0X220 with a speed of 0X380
Instruction Packet : 0XFF 0XFF 0XFE 0X18 0X83 0X1E 0X04 0X00 0X10 0X00 0X50
0X01 0X01 0X20 0X02 0X60 0X03 0X02 0X30 0X00 0X70 0X01 0X03 0X20 0X02 0X80
0X03 0X12
No status packets are returned since the Broadcasting ID was used.
24
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
5. Example
For the following examples, we assume a Dynamixel actuator with an ID of 1 in Reset
status and that the Baud rate is 57142 BPS.
Example 6
Reading the Model Number and Firmware Version of the Dynamixel actuator with
an ID of 1
Instruction Packet
Communication
Instruction = READ_DATA, Address = 0x00, Length = 0x03
->[Dynamixel]:FF FF 01 04 02 00 03 F5 (LEN:008)
<-[Dynamixel]:FF FF 01 05 00 1C 00 08 D5 (LEN:009)
Status Packet Result Model Number = 28 (0x1C) (for the case of RX-28) Firmware Version = 0x08
Example 7
Changing the ID to 0 for a Dynamixel actuator with an ID of 1
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x03, DATA = 0x00
->[Dynamixel]:FF FF 01 04 03 03 00 F4 (LEN:008)
<-[Dynamixel]:FF FF 01 02 00 FC (LEN:006)
Status Packet Result NO ERROR
Example 8
Changing the Baud Rate of a Dynamixel actuator to 1M bps
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x04, DATA = 0x01
->[Dynamixel]:FF FF 00 04 03 04 01 F3 (LEN:008)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Example 9
Resetting the Return Delay Time to 4 uSec for a Dynamixel actuator with an ID of
0
A Return Delay Time Value of 1 corresponds to 2uSec.
25
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x05, DATA = 0x02
->[Dynamixel]:FF FF 00 04 03 05 02 F1 (LEN:008)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
It is recommended to set the Return Delay Time to the minimum value allowed by the
Main Controller.
Example 10
Limiting the operating angle range to 0°~150° for a Dynamixel actuator with an ID
of 0
Since the CCW Angle Limit of 0x3ff corresponds to 300°, the angle 150° is represented
by the value 0x1ff
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x08, DATA = 0xff, 0x01
->[Dynamixel]:FF FF 00 05 03 08 FF 01 EF (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Example 11
Resetting the upper limit for the operating temperature to 80°C for a Dynamixel
actuator with an ID of 0
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x0B, DATA = 0x50
->[Dynamixel]:FF FF 00 04 03 0B 50 9D (LEN:008)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Example 12
Setting the operating voltage to 10V ~ 17V for a Dynamixel actuator with an ID of 0
10V is represented by 100 (0x64), and 17V by 170 (0xAA).
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x0C, DATA = 0x64, 0xAA
->[Dynamixel]:FF FF 00 05 03 0C 64 AA DD (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
26
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Example 13
Setting the maximum torque to 50% of its maximum possible value for a
Dynamixel actuator with an ID of 0
Set the MAX Torque value located in the ROM area to 0x1ff which is 50% of the
maximum value 0x3ff.
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x0E, DATA = 0xff, 0x01
->[Dynamixel]:FF FF 00 05 03 0E FF 01 E9 (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
To verify the effect of the adjusted Max Torque value, the power needs to be turned off
and then on.
Example 14
Set the Dynamixel actuator with an ID of 0 to never return a Status Packet
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x10, DATA = 0x00
->[Dynamixel]:FF FF 00 04 03 10 00 E8 (LEN:008)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
The Status Packet is not returned starting with the following instruction.
Example 15
Set the Alarm to blink the LED and Shutdown (Torque off) the actuator when the
operating temperature goes over the set limit
Since the Overheating Error is Bit 2, set the Alarm value to 0x04.
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x11, DATA = 0x04, 0x04
->[Dynamixel]:FF FF 00 05 03 11 04 04 DE (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Example 16
Turn on the LED and Enable Torque for a Dynamixel actuator with an ID of 0
27
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x18, DATA = 0x01, 0x01
->[Dynamixel]:FF FF 00 05 03 18 01 01 DD (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
You can verify the Torque Enabled status by trying to move the output of the actuator by
hand.
Example 17
Compliance
Setting the Compliance Margin to 1 and Compliance Slope to 0x40 for a
Dynamixel actuator with an ID of 0
The Angle Error and Torque Output can be represented with the following graph.
CW
Goal Position
CCW
CW
X:Angle Error
CCW
Even if the position deviates a little from the goal position in the CW direction, a large
amount of torque is generated in the CCW direction to compensate for this. However,
since inertia must be considered, a realistic implementation differs from this approach.
Considering this, the given conditions can be represented by the following graph.
CW
Goal Position
CCW
CW
Angle(Position)
Output Torque
CCW
A
B
C
D
A : CCW Compliance Slope (Address0x1D) = 0x40 (about 18.8°)
B : CCW Compliance Margin (Address0x1B) = 0x01 (about 0.29°)
C : CW Compliance Margin (Address0x01A) = 0x01 (about 0.29°)
28
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
D : CW Compliance Slope (Address0x1C) = 0x40 (about 18.8°)
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x1A, DATA = 0x01, 0x01, 0x40, 0x40
->[Dynamixel]:FF FF 00 07 03 1A 01 01 40 40 59 (LEN:011)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
The Compliance Slope takes effect with discrete steps of 2n (n is integer). Thus any
Compliance value between 0x11 and 0x20 has identical effects.
Example 18
Position the output of a Dynamixel actuator with an ID of 0 to 180° with an angular
velocity of 057RPM
Set Address 0x1E (Goal Position) to 0x200 and Address 0x20 (Moving Speed) to 0x200.
Instruction = WRITE_DATA, Address = 0x1E, DATA = 0x00, 0x02, 0x00, 0x02
Instruction Packet
Communication
->[Dynamixel]:FF FF 00 07 03 1E 00 02 00 02 D3 (LEN:011)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Example 19
Position the output of a Dynamixel actuator with an ID of 0 to 0° and Position the
output of a Dynamixel actuator with an ID of 1 to 300°, and initiate the movement
at the same time.
If the WRITE_DATA is used, the movement of the two actuators cannot be initiate at the
same time, thus the REG_WRITE and ACTION instructions should be used instead.
Instruction Packet
Communication
ID=0, Instruction = REG_WRITE, Address = 0x1E, DATA = 0x00, 0x00
ID=1, Instruction = REG_WRITE, Address = 0x1E, DATA = 0xff, 0x03
ID=0xfe(Broadcasting ID), Instruction = ACTION,
->[Dynamixel]:FF FF 00 05 04 1E 00 00 D8 (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
->[Dynamixel]:FF FF 01 05 04 1E FF 03 D5 (LEN:009)
<-[Dynamixel]:FF FF 01 02 00 FC (LEN:006)
->[Dynamixel]:FF FF FE 02 05 FA (LEN:006)
<-[Dynamixel]:
//No return packet against broadcasting ID
29
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Status Packet Result NO ERROR
Example 20
Lock all addresses except for Address 0x18 ~ Address0x23 for a Dynamixel
actuator with an ID of 0
Set Address 0x2F (Lock) to 1.
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x2F, DATA = 0x01
->[Dynamixel]:FF FF 00 04 03 2F 01 C8 (LEN:008)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
Once locked, the only way to unlock it is to remove the power.
If an attempt is made to access any locked data, an error is returned.
->[Dynamixel]:FF FF 00 05 03 30 40 00 87 (LEN:009)
<-[Dynamixel]:FF FF 00 02 08 F5 (LEN:006)
Range Error
Example 21
Set the minimum power (Punch) to 0x40 for a Dynamixel actuator with an ID of 0
Instruction Packet
Communication
Instruction = WRITE_DATA, Address = 0x30, DATA = 0x40, 0x00
->[Dynamixel]:FF FF 00 05 03 30 40 00 87 (LEN:009)
<-[Dynamixel]:FF FF 00 02 00 FD (LEN:006)
Status Packet Result NO ERROR
30
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Appendix
RS485 UART
RS485 UART is a serial communication protocol where both TxD and RxD cannot be
used at the same time. This method is generally used when many devices need to be
connected to a single bus. Since more than one device are connected to the same bus,
all the other devices need to be in input mode while one device is transmitting. The Main
Controller that controllers the Dynamixel actuators sets the communication direction to
input mode, and only when it is transmitting an Instruction Packet, it changes the
direction to output mode.
RS485 Direction Output Duration
Instruction Packet
Status Packet
Return Delay Time
Return Delay Time
Tx,Rx Direction
The time it takes for the Dynamixel actuator to return the Status Packet after receiving
an Instruction Packet. The Default Value is 160 uSec and can be changed via the
Control Table at Address 5. The Main Controller needs to change the Direction Port to
input mode during the Return Delay Time after sending an instruction packet.
For RS485 UART, the transmission ending timing is important to change the direction to
receiving mode. The bit definitions within the register that indicates UART_STATUS are
as the following
TXD_BUFFER_READY_BIT: Indicates that the transmission DATA can be loaded into
the Buffer. Note that this only means that the SERIAL TX BUFFER is empty, and does
not necessarily mean that the all the data transmitted before has left the CPU.
TXD_SHIFT_REGISTER_EMPTY_BIT: Set when all the Transmission Data has
completed its transmission and left the CPU.
The TXD_BUFFER_READY_BIT is used when one byte is to be transmitted via the
serial communication channel, and an example is shown below.
TxDByte(byte bData)
{
while(!TXD_BUFFER_READY_BIT); //wait until data can be loaded.
SerialTxDBuffer = bData;
//data load to TxD buffer
}
31
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
When changing the direction, the TXD_SHIFT_REGISTER_EMPTY_BIT must be
checked.
The following is an example program that sends an Instruction Packet.
LINE 1
DIRECTION_PORT = TX_DIRECTION;
TxDByte(0xff);
TxDByte(0xff);
TxDByte(bID);
TxDByte(bLength);
LINE 2
LINE 3
LINE 4
LINE 5
LINE 6
LINE 7
LINE 8
LINE 9
LINE 10
LINE 11
LINE 12
TxDByte(bInstruction);
TxDByte(Parameter0); TxDByte(Parameter1); …
DisableInterrupt(); // interrupt should be disable
TxDByte(Checksum); //last TxD
while(!TXD_SHIFT_REGISTER_EMPTY_BIT); //Wait till last data bit has been sent
DIRECTION_PORT = RX_DIRECTION; //Direction change to RXD
EnableInterrupt(); // enable interrupt again
Please note the important lines between LINE 8 and LINE 12. Line 8 is necessary since
an interrupt here may cause a delay longer than the return delay time and corruption to
the front of the status packet may occur.
Byte to Byte Time
The delay time between bytes when sending an instruction packet. If the delay time is
over 100ms, then the Dynamixel actuator recognizes this as a communication problem
and waits for the next header (0xff 0xff) of a packet again.
0xFF
0xFF
ID
Length
Byte To Byte Time
The following is the source code of a program (Example.c) that accesses the Dynamixel
actuator using the Atmega 128.
32
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
C Language Example : Dinamixel access with Atmega128
#define P_REGISTERED_INSTRUCTION (44)
/*
#define P_PAUSE_TIME
#define P_MOVING (46)
#define P_LOCK
(45)
* The Example of Dynamixel Evaluation with Atmega128
* Date : 2005.5.11
* Author : BS KIM
*/
(47)
(48)
(49)
#define P_PUNCH_L
#define P_PUNCH_H
/*
//--- Instruction ---
#define INST_PING
#define INST_READ
* included files
*/
0x01
0x02
0x03
0x04
0x05
0x06
#define ENABLE_BIT_DEFINITIONS
//#include <io.h>
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#define INST_WRITE
#define INST_REG_WRITE
#define INST_ACTION
#define INST_RESET
#define INST_DIGITAL_RESET 0x07
#define INST_SYSTEM_READ
#define INST_SYSTEM_WRITE
#define INST_SYNC_WRITE
0x0C
0x0D
0x83
#define cbi(REG8,BITNUM) REG8 &= ~(_BV(BITNUM))
#define sbi(REG8,BITNUM) REG8 |= _BV(BITNUM)
#define INST_SYNC_REG_WRITE 0x84
#define CLEAR_BUFFER gbRxBufferReadPointer = gbRxBufferWritePointer
#define DEFAULT_RETURN_PACKET_SIZE 6
typedef unsigned char byte;
typedef unsigned int word;
#define ON 1
#define BROADCASTING_ID 0xfe
#define OFF 0
#define _ON 0
#define TxD8 TxD81
#define RxD8 RxD81
#define _OFF 1
//Hardware Dependent Item
#define DEFAULT_BAUD_RATE 34
//57600bps at 16MHz
//--- Control Table Address ---
//EEPROM AREA
////// For CM-2 PLUS
#define P_MODEL_NUMBER_L
#define P_MODOEL_NUMBER_H
#define P_VERSION
0
#define
#define
/*
RS485_TXD
RS485_RXD
PORTE
//PORT_485_DIRECTION = 1
PORTE &= ~_BV(PE2),PORTE
//PORT_485_DIRECTION = 0
&=
~_BV(PE3),PORTE
|=
|=
_BV(PE2)
_BV(PE3)
1
2
#define P_ID
3
#define P_BAUD_RATE
4
#define P_RETURN_DELAY_TIME
#define P_CW_ANGLE_LIMIT_L
#define P_CW_ANGLE_LIMIT_H
#define P_CCW_ANGLE_LIMIT_L
#define P_CCW_ANGLE_LIMIT_H
#define P_SYSTEM_DATA2
#define P_LIMIT_TEMPERATURE
5
////// For CM-2
#define RS485_TXD PORTE |= _BV(PE2); //_485_DIRECTION = 1
6
7
#define RS485_RXD PORTE &= ~_BV(PE2);//PORT_485_DIRECTION = 0
*/
8
9
//#define TXD0_FINISH UCSR0A,6 //This bit is for checking TxD Buffer
in CPU is empty or not.
10
11
//#define TXD1_FINISH UCSR1A,6
#define P_DOWN_LIMIT_VOLTAGE 12
#define P_UP_LIMIT_VOLTAGE
#define P_MAX_TORQUE_L
#define P_MAX_TORQUE_H
#define P_RETURN_LEVEL
#define P_ALARM_LED
13
14
15
16
17
18
19
#define SET_TxD0_FINISH
sbi(UCSR0A,6)
#define RESET_TXD0_FINISH cbi(UCSR0A,6)
#define CHECK_TXD0_FINISH bit_is_set(UCSR0A,6)
#define SET_TxD1_FINISH sbi(UCSR1A,6)
#define RESET_TXD1_FINISH cbi(UCSR1A,6)
#define CHECK_TXD1_FINISH bit_is_set(UCSR1A,6)
#define P_ALARM_SHUTDOWN
#define P_OPERATING_MODE
#define P_DOWN_CALIBRATION_L 20
#define P_DOWN_CALIBRATION_H 21
#define RX_INTERRUPT 0x01
#define TX_INTERRUPT 0x02
#define OVERFLOW_INTERRUPT 0x01
#define SERIAL_PORT0 0
#define P_UP_CALIBRATION_L
#define P_UP_CALIBRATION_H
22
23
#define SERIAL_PORT1 1
#define BIT_RS485_DIRECTION0 0x08 //Port E
#define BIT_RS485_DIRECTION1 0x04 //Port E
#define P_TORQUE_ENABLE
#define P_LED
(24)
(25)
#define P_CW_COMPLIANCE_MARGIN (26)
#define P_CCW_COMPLIANCE_MARGIN (27)
#define BIT_ZIGBEE_RESET
PD4 //out : default 1 //PORTD
#define P_CW_COMPLIANCE_SLOPE
#define P_CCW_COMPLIANCE_SLOPE (29)
(28)
#define BIT_ENABLE_RXD_LINK_PC
#define BIT_ENABLE_RXD_LINK_ZIGBEE
#define BIT_LINK_PLUGIN
PD5 //out : default 1
PD6 //out : default 0
PD7 //in, no pull up
#define P_GOAL_POSITION_L
#define P_GOAL_POSITION_H
#define P_GOAL_SPEED_L
(30)
(31)
(32)
(33)
(34)
(35)
(36)
(37)
(38)
(39)
(40)
(41)
(42)
(43)
void TxD81(byte bTxdData);
void TxD80(byte bTxdData);
void TxDString(byte *bData);
void TxD8Hex(byte bSentData);
void TxD32Dec(long lLong);
byte RxD81(void);
#define P_GOAL_SPEED_H
#define P_TORQUE_LIMIT_L
#define P_TORQUE_LIMIT_H
#define P_PRESENT_POSITION_L
#define P_PRESENT_POSITION_H
#define P_PRESENT_SPEED_L
#define P_PRESENT_SPEED_H
#define P_PRESENT_LOAD_L
#define P_PRESENT_LOAD_H
#define P_PRESENT_VOLTAGE
#define P_PRESENT_TEMPERATURE
void MiliSec(word wDelayTime);
void PortInitialize(void);
void SerialInitialize(byte bPort, byte bBaudrate, byte bInterrupt);
byte TxPacket(byte bID, byte bInstruction, byte bParameterLength);
byte RxPacket(byte bRxLength);
void PrintBuffer(byte *bpPrintBuffer, byte bLength);
33
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
// --- Gloval Variable Number ---
volatile byte gbpRxInterruptBuffer[256];
byte gbpParameter[128];
TxDString("\r\n\n Example 4. LED OFF -- Any Key to Continue.");
RxD8();
gbpParameter[0] = P_LED; //Address of LED
gbpParameter[1] = 0; //Writing Data
byte gbRxBufferReadPointer;
byte gbpRxBuffer[128];
bTxPacketLength = TxPacket(bID,INST_WRITE,2);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
byte gbpTxBuffer[128];
volatile byte gbRxBufferWritePointer;
int main(void)
{
byte bCount,bID, bTxPacketLength,bRxPacketLength;
TxDString("\r\n\n Example 5. Read Control Table. -- Any Key to
Continue."); RxD8();
gbpParameter[0] = 0; //Reading Address
gbpParameter[1] = 49; //Read Length
bTxPacketLength = TxPacket(bID,INST_READ,2);
PortInitialize(); //Port In/Out Direction Definition
RS485_RXD; //Set RS485 Direction to Input State.
SerialInitialize(SERIAL_PORT0,1,RX_INTERRUPT);//RS485
Initializing(RxInterrupt)
bRxPacketLength
=
RxPacket(DEFAULT_RETURN_PACKET_SIZE+gbpParameter
[1]);
SerialInitialize(SERIAL_PORT1,DEFAULT_BAUD_RATE,0);
Initializing(None Interrupt)
//RS232
//RS485
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
gbRxBufferReadPointer = gbRxBufferWritePointer
RxBuffer Clearing.
=
0;
if(bRxPacketLength == DEFAULT_RETURN_PACKET_SIZE+gbpParameter[1])
{
sei(); //Enable Interrupt -- Compiler Function
TxDString("\r\n");
for(bCount = 0; bCount < 49; bCount++)
TxDString("\r\n [The Example of Dynamixel Evaluation with
ATmega128,GCC-AVR]");
{
TxD8('[');TxD8Hex(bCount);TxDString("]:");
//Dynamixel Communication Function Execution Step.
// Step 1. Parameter Setting (gbpParameter[]). In case of no parameter
instruction(Ex. INST_PING), this step is not
needed.
TxD8Hex(gbpRxBuffer[bCount+5]);TxD8(' ');
}
}
//
Step
2.
TxPacket(ID,INSTRUCTION,LengthOfParameter);
TxPacket Length is returned
--Total
TxDString("\r\n\n Example 6. Go 0x200 with Speed 0x100 -- Any Key to
Continue."); RxD8();
// Step 3. RxPacket(ExpectedReturnPacketLength); -- Real RxPacket
Length is returned
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x02; //Writing Data P_GOAL_POSITION_H
gbpParameter[3] = 0x00; //Writing Data P_GOAL_SPEED_L
gbpParameter[4] = 0x01; //Writing Data P_GOAL_SPEED_H
bTxPacketLength = TxPacket(bID,INST_WRITE,5);
// Step 4 PrintBuffer(BufferStartPointer,LengthForPrinting);
bID = 1;
TxDString("\r\n\n Example 1. Scanning Dynamixels(0~9). -- Any Key to
Continue."); RxD8();
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
for(bCount = 0; bCount < 0x0A; bCount++)
{
bTxPacketLength = TxPacket(bCount,INST_PING,0);
bRxPacketLength = RxPacket(255);
TxDString("\r\n\n Example 7. Go 0x00 with Speed 0x40 -- Any Key to
Continue."); RxD8();
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString(", RxD:");
if(bRxPacketLength == DEFAULT_RETURN_PACKET_SIZE)
PrintBuffer(gbpRxBuffer,bRxPacketLength);
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x00; //Writing Data P_GOAL_POSITION_H
gbpParameter[3] = 0x40; //Writing Data P_GOAL_SPEED_L
gbpParameter[4] = 0x00; //Writing Data P_GOAL_SPEED_H
bTxPacketLength = TxPacket(bID,INST_WRITE,5);
{
TxDString(" Found!! ID:");TxD8Hex(bCount);
bID = bCount;
}
}
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
TxDString("\r\n\n Example 2. Read Firmware Version. -- Any Key to
Continue."); RxD8();
gbpParameter[0] = P_VERSION; //Address of Firmware Version
gbpParameter[1] = 1; //Read Length
bTxPacketLength = TxPacket(bID,INST_READ,2);
TxDString("\r\n\n Example 8. Go 0x3ff with Speed 0x3ff -- Any Key to
Continue."); RxD8();
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0xff; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x03; //Writing Data P_GOAL_POSITION_H
gbpParameter[3] = 0xff; //Writing Data P_GOAL_SPEED_L
gbpParameter[4] = 0x03; //Writing Data P_GOAL_SPEED_H
bTxPacketLength = TxPacket(bID,INST_WRITE,5);
bRxPacketLength
=
RxPacket(DEFAULT_RETURN_PACKET_SIZE+gbpParameter
[1]);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
if(bRxPacketLength == DEFAULT_RETURN_PACKET_SIZE+gbpParameter[1])
{
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
TxDString("\r\n Return Error
: ");TxD8Hex(gbpRxBuffer[4]);
TxDString("\r\n Firmware Version : ");TxD8Hex(gbpRxBuffer[5]);
}
TxDString("\r\n\n Example 9. Torque Off -- Any Key to Continue.");
RxD8();
TxDString("\r\n\n Example 3. LED ON -- Any Key to Continue.");
RxD8();
gbpParameter[0] = P_LED; //Address of LED
gbpParameter[0] = P_TORQUE_ENABLE; //Address of LED
gbpParameter[1] = 0; //Writing Data
bTxPacketLength = TxPacket(bID,INST_WRITE,2);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
gbpParameter[1] = 1; //Writing Data
bTxPacketLength = TxPacket(bID,INST_WRITE,2);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
TxDString("\r\n\n End. Push reset button for repeat");
34
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
while(1);
}
bTimeout = 0;
for(bCount = 0; bCount < bRxPacketLength; bCount++)
void PortInitialize(void)
{
{
ulCounter = 0;
while(gbRxBufferReadPointer == gbRxBufferWritePointer)
DDRA = DDRB = DDRC = DDRD = DDRE = DDRF = 0; //Set all port to
input direction first.
{
PORTB = PORTC = PORTD = PORTE = PORTF = PORTG = 0x00; //PortData
initialize to 0
if(ulCounter++ > RX_TIMEOUT_COUNT1)
{
cbi(SFIOR,2); //All Port Pull Up ready
DDRE |= (BIT_RS485_DIRECTION0|BIT_RS485_DIRECTION1); //set output
the bit RS485direction
bTimeout = 1;
break;
}
}
if(bTimeout) break;
gbpRxBuffer[bCount]
DDRD
|=
(BIT_ZIGBEE_RESET|BIT_ENABLE_RXD_LINK_PC|BIT_ENA
BLE_RXD_LINK_ZIGBEE);
=
gbpRxInterruptBuffer[gbRxBufferReadPointer++];
}
PORTD &= ~_BV(BIT_LINK_PLUGIN); // no pull up
PORTD |= _BV(BIT_ZIGBEE_RESET);
bLength = bCount;
bChecksum = 0;
PORTD |= _BV(BIT_ENABLE_RXD_LINK_PC);
PORTD |= _BV(BIT_ENABLE_RXD_LINK_ZIGBEE);
if(gbpTxBuffer[2] != BROADCASTING_ID)
{
}
if(bTimeout && bRxPacketLength != 255)
{
/*
TxPacket() send data to RS485.
TxDString("\r\n [Error:RxD Timeout]");
TxPacket() needs 3 parameter; ID of Dynamixel, Instruction byte,
Length of parameters.
TxPacket() return length of Return packet from Dynamixel.
CLEAR_BUFFER;
}
*/
if(bLength > 3) //checking is available.
byte TxPacket(byte bID, byte bInstruction, byte bParameterLength)
{
{
if(gbpRxBuffer[0] != 0xff || gbpRxBuffer[1] != 0xff )
byte bCount,bCheckSum,bPacketLength;
{
TxDString("\r\n [Error:Wrong Header]");
CLEAR_BUFFER;
gbpTxBuffer[0] = 0xff;
gbpTxBuffer[1] = 0xff;
gbpTxBuffer[2] = bID;
return 0;
}
if(gbpRxBuffer[2] != gbpTxBuffer[2] )
gbpTxBuffer[3]
=
bParameterLength+2;
//Length(Paramter,Instruction,Checksum)
{
gbpTxBuffer[4] = bInstruction;
for(bCount = 0; bCount < bParameterLength; bCount++)
TxDString("\r\n [Error:TxID != RxID]");
CLEAR_BUFFER;
{
return 0;
gbpTxBuffer[bCount+5] = gbpParameter[bCount];
}
}
bCheckSum = 0;
if(gbpRxBuffer[3] != bLength-4)
{
bPacketLength = bParameterLength+4+2;
TxDString("\r\n [Error:Wrong Length]");
for(bCount = 2; bCount < bPacketLength-1; bCount++) //except
0xff,checksum
CLEAR_BUFFER;
return 0;
}
{
bCheckSum += gbpTxBuffer[bCount];
for(bCount = 2; bCount < bLength; bCount++) bChecksum +=
gbpRxBuffer[bCount];
}
gbpTxBuffer[bCount] = ~bCheckSum; //Writing Checksum with Bit
Inversion
if(bChecksum != 0xff)
{
TxDString("\r\n [Error:Wrong CheckSum]");
CLEAR_BUFFER;
RS485_TXD;
for(bCount = 0; bCount < bPacketLength; bCount++)
{
return 0;
}
sbi(UCSR0A,6);//SET_TXD0_FINISH;
TxD80(gbpTxBuffer[bCount]);
}
}
return bLength;
}
while(!CHECK_TXD0_FINISH); //Wait until TXD Shift register empty
}
RS485_RXD;
return(bPacketLength);
}
/*
PrintBuffer() print data in Hex code.
/*
PrintBuffer() needs two parameter; name of Pointer(gbpTxBuffer,
gbpRxBuffer)
RxPacket() read data from buffer.
RxPacket() need a Parameter; Total length of Return Packet.
RxPacket() return Length of Return Packet.
*/
*/
void PrintBuffer(byte *bpPrintBuffer, byte bLength)
{
byte bCount;
for(bCount = 0; bCount < bLength; bCount++)
byte RxPacket(byte bRxPacketLength)
{
{
#define RX_TIMEOUT_COUNT2
3000L
TxD8Hex(bpPrintBuffer[bCount]);
#define RX_TIMEOUT_COUNT1 (RX_TIMEOUT_COUNT2*10L)
unsigned long ulCounter;
TxD8(' ');
}
byte bCount, bLength, bChecksum;
byte bTimeout;
TxDString("(LEN:");TxD8Hex(bLength);TxD8(')');
}
35
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
}
/*
Print value of Baud Rate.
/*
*/
void PrintBaudrate(void)
TXD81() send data to USART 1.
*/
void TxD81(byte bTxdData)
{
TxDString("\r\n
{
RS232:");TxD32Dec((16000000L/8L)/((long)UBRR1L+1
L) ); TxDString(" BPS,");
while(!TXD1_READY);
TXD1_DATA = bTxdData;
}
TxDString("
RS485:");TxD32Dec((16000000L/8L)/((long)UBRR0L+1L) );
TxDString(" BPS");
}
/*
TXD32Dex() change data to decimal number system
*/
void TxD32Dec(long lLong)
/*Hardware Dependent Item*/
#define TXD1_READY
bit_is_set(UCSR1A,5)
{
//(UCSR1A_Bit5)
byte bCount, bPrinted;
long lTmp,lDigit;
bPrinted = 0;
#define TXD1_DATA
#define RXD1_READY
#define RXD1_DATA
(UDR1)
bit_is_set(UCSR1A,7)
(UDR1)
if(lLong < 0)
{
lLong = -lLong;
#define TXD0_READY
#define TXD0_DATA
#define RXD0_READY
#define RXD0_DATA
bit_is_set(UCSR0A,5)
(UDR0)
TxD8('-');
bit_is_set(UCSR0A,7)
(UDR0)
}
lDigit = 1000000000L;
for(bCount = 0; bCount < 9; bCount++)
{
lTmp = (byte)(lLong/lDigit);
/*
SerialInitialize() set Serial Port to initial state.
Vide Mega128 Data sheet about Setting bit of register.
SerialInitialize() needs port, Baud rate, Interrupt value.
if(lTmp)
{
TxD8(((byte)lTmp)+'0');
*/
bPrinted = 1;
void SerialInitialize(byte bPort, byte bBaudrate, byte bInterrupt)
{
}
else if(bPrinted) TxD8(((byte)lTmp)+'0');
if(bPort == SERIAL_PORT0)
lLong -= ((long)lTmp)*lDigit;
{
lDigit = lDigit/10;
UBRR0H = 0; UBRR0L = bBaudrate;
}
UCSR0A = 0x02; UCSR0B = 0x18;
lTmp = (byte)(lLong/lDigit);
if(bInterrupt&RX_INTERRUPT) sbi(UCSR0B,7); // RxD interrupt enable
UCSR0C = 0x06; UDR0 = 0xFF;
/*if(lTmp)*/ TxD8(((byte)lTmp)+'0');
}
sbi(UCSR0A,6);//SET_TXD0_FINISH; // Note. set 1, then 0 is read
}
/*
else if(bPort == SERIAL_PORT1)
{
TxDString() prints data in ACSII code.
*/
UBRR1H = 0; UBRR1L = bBaudrate;
void TxDString(byte *bData)
UCSR1A = 0x02; UCSR1B = 0x18;
if(bInterrupt&RX_INTERRUPT) sbi(UCSR1B,7); // RxD interrupt enable
{
while(*bData)
UCSR1C = 0x06; UDR1 = 0xFF;
{
sbi(UCSR1A,6);//SET_TXD1_FINISH; // Note. set 1, then 0 is read
TxD8(*bData++);
}
}
}
}
/*
TxD8Hex() print data seperatly.
/*
RxD81() read data from UART1.
ex> 0x1a -> '1' 'a'.
*/
RxD81() return Read data.
*/
void TxD8Hex(byte bSentData)
{
byte RxD81(void)
{
byte bTmp;
while(!RXD1_READY);
return(RXD1_DATA);
}
bTmp =((byte)(bSentData>>4)&0x0f) + (byte)'0';
if(bTmp > '9') bTmp += 7;
TxD8(bTmp);
/*
bTmp =(byte)(bSentData & 0x0f) + (byte)'0';
if(bTmp > '9') bTmp += 7;
SIGNAL() UART0 Rx Interrupt - write data to buffer
*/
SIGNAL (SIG_UART0_RECV)
TxD8(bTmp);
}
{
gbpRxInterruptBuffer[(gbRxBufferWritePointer++)] = RXD0_DATA;
}
/*
TxD80() send data to USART 0.
*/
void TxD80(byte bTxdData)
{
while(!TXD0_READY);
TXD0_DATA = bTxdData;
36
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Connector
Company Name : Molex
Pin Number: 4 (or 5 for Optional VCC 5V)
Model Number
Molex Part Number
Old Part Number
5267-04
Male
22-03-5045
50-37-5043
Female
5264-04
Temperature range : -40°C to +105°C
Contact Insertion Force-max : 14.7N (3.30 lb)
Contact Retention Force-min : 14.7N (3.30 lb)
Female Connector
Male Connector
Pin No.1
37
Download from Www.Somanuals.com. All Manuals Search And Download.
DYNAMIXEL
RX-28
Dimension
38
Download from Www.Somanuals.com. All Manuals Search And Download.
|