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)
CommunicationWiring is easy with daisy chain connecti on, and it support communication speeds u p 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 The main body of the unit is made with high quality engineering plastic which enables it
to handle high torque loads.
Axis Bearing A bearing is used at the final axis to ensure no efficiency degradation with high external
loads.
Status LED The LED can indicate the error status to the user.
Frames A hinge frame and a side mount frame are supported by option.
2
DYNAMIXEL
RX-28
1-2. Main Specifications
RX-28
Weight (g) 72
Gear Reduction Ratio 1/193
Input Voltage (V) at 12V at 16V
Final Max Holding Torque(kgf.cm) 28.3 37.7
Sec/60degree 0.167 0.126
Resolution 0.3°
Operating Angle 300°, Endless Turn
Voltage 12V~16V (Recommended voltage: 14.4V)
Max. Current 1200mA
Operate Temp erature -5 ~ +85℃℃
Command Signal Digital Packet
Protocol Type RS485 Asynchronous Serial Communication (8bit,1stop,No Parity)
Link (Physical) RS48 5 Multi Drop Bus
ID 254 ID (0~253)
Communication Speed 7343bps ~ 1 Mbps
Feedback Position, Temperature, Load, Input Voltage, etc.
Material Full Metal Gear, Engineering Plastic
Motor Maxon RE-MAX
3
DYNAMIXEL
RX-28
2. Dynamixel Operation
2-1. Mechanical Assembly
Option Frames
OF-28B OF-28S
RXOF-28H Horn-28T
4
DYNAMIXEL
Assembly Sample assembly using option frames.
RX-28
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
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)
PIN4: DPIN3: D+
PIN2: VDD(12V~21V)
Wiring Connect the RX-28 actuators pin to pin as shown below. Many RX-28 actuators can be
Main Controller To operate the Dynamixel actuators, the main controller must support RS485 UART. A
PIN1: GND
controlled with a single bus in this manner.
Control Box “CM-2
proprietary controller can be used, but the use of the Dynamixel controller CM-2 PLUS is
recommended.
PIN1: GND
PIN2: VDD(12V~21V)
PIN3: D+
PIN4: D-
6
DYNAMIXEL
Connection to UART To control the Dynamixel actuators, the main controller needs to convert its UART
RS485 UART A multi-drop method of connecting multiple Dynamixel actuators to a single node is
RX-28
signals to the RS485 type. The recommended circuit diagram for this is shown below.\
VDD
The power is supplied to the Dynamixel actuator from the main controller through Pi n 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
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
CCW
[Multi Drop Link]
7
DYNAMIXEL
Caution Please ensure that the pin assignments are correct when connecting the Dynamixel
Connection Status Verification
Inspection If the above operation was not successful, then check the conne ctor pin assign ment an d
RX-28
actuators. Check the current consumption when powering on. T he current consumption
of a single Dynamixel actuator unit in standby mode should be no larger than 50mA
When power is applied to the Dynamixel actuator, the LED blinks twice to confirm its
connection.
the voltage/current limit of the power supply.
8
r
r
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.)
Communication For the system connectio n 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.
Unique ID If multiple Dynamixel units have the same ID value, multiple packets sent
Protocol The Dynamixel actuators communicate through asynchronous serial communication
Instruction Packet(ID=N)
Main
Controlle
simultaneously collide, resulting in communication problems. Thus, it is imperative that
no Dynamixel units share the same ID in a network node.
with 8 bit, 1 stop bit and no parity.
Main
Controlle
Instruction Packet
Status Packet
ID=0ID=1ID=N
Status Packet(ID=N)
9
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.
Instruction Packet
0XFF 0XFF The two 0XFF bytes indicate the start of an incoming packet.
ID The unique ID of a Dynamixel unit. There are 254 available ID values, ranging from
Broadcasting ID ID 0XFE is the Broadcasting ID which indicates all of the connected D ynamixel units.
LENGTH The length of the packet where its value is “Number of parameters (N) + 2”
INSTRUCTION The instruction for the Dynamixel actuator to perform.
PARAMETER0…N Used if there is additional information needed to be sent other than the instruction itself.
CHECK SUM The computation method for the ‘Check Sum’ 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.
0X00 to 0XFD.
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.
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
DYNAMIXEL
0XFF 0XFF The two 0XFF bytes indicate the start of the packet.
ID The unique ID of the Dynamixel unit returning the packet. The initial value is set to 1.
LENGTH The length of the packet where its value is “Number of parameters (N) + 2”
ERROR The byte repres enting errors sent from the Dynamixel unit. The meaning of each bit is
RX-28
The meanings of each packet byte definition are as the following.
as the following.
Bit Name Details
Bit 7 0 -
Set to 1 if an undefined instruction is sent or an action
Bit 6 Instruction Error
instruction is sent without a Reg_Write instruction.
Set to 1 if the specified maximum torque can't control the
Bit 5 Overload Error
applied load.
Bit 4 Checksum ErrorSet to 1 if the checksum of the instruction packet is incorrect.
Bit 3 Range Error Set to 1 if the instruction sent is out of the defined range.
Bit 2
Overheating
Error
Angle Limit
Bit 1
Error
Input Voltage
Bit 0
Error
PARAMETER0…N Used if additional information is needed.
CHECK SUM 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.
Set to 1 if the internal temperature of the Dynamixel unit is
above the operating temperature range as defined in the
control table.
Set as 1 if the Goal Position is set outside of the range
between CW Angle Limit and CCW Angle
Limit.
Set to 1 if the voltage is out of the operating voltage range as
defined in the control table.
11
DYNAMIXEL
3-4. Control
Table
EEPROM
Area
RAM
Area
RX-28
Add r e s sItemAcce s sInitia l Valu e
0(0X00)Model Number(L)RD
1(0X01)Model Number(H)RD
2(0X02)Version of FirmwareRD
3(0X03)IDRD,W R
4(0X04)Baud RateRD,WR
5(0X05)Return Delay TimeRD,WR
6(0X06)CW Angle Limit(L)RD,WR
7(0X07)CW Angle Limit(H)RD,W R
8(0X08)CCW A ngle Limit(L)R D ,WR
9(0X09)CCW A ngle Limit(H)RD,WR
25(0X19)LEDRD,W R
26(0X1A)CW C ompliance MarginRD,WR
27(0X1B)CCW C ompliance MarginRD,W R
28(0X1C)C W Compliance SlopeRD ,WR
29(0X1D)C C W Compliance SlopeR D ,WR
30(0X1E)Goal Position(L)RD,WR
Address 0x05 Return Delay Time. The time it takes for the Status Packet to return after the Instruction
Address 0x06,0x07,0x08,0x09
Address 0x0B
Address 0x0C,0x0D the Lowest (Highest) Limit Voltage. The upper and lower limits of the Dynamixel
Address 0x0E,0x0F, 0x22,0x23
Address 0X10 Status Return Level. Determines whether the Dynamixel actuator will return a Status
the Highest Limit Temperature. The upper limit of the Dynamixel actuator ’s operating
RX-28
Packet is sent. The delay time is given by 2uSec * Address5 value.
Operating Angle Limit
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.
temperature. If the internal temperatur e of the Dynamixel actuator gets higher tha n 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.
actuator’s operating voltage. If t he 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.
Max Torque
is set to 0, the Dynamixel actuator enters th e Free Run mode. There are two locat ions
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 l ocation in the RAM. The torque of
the Dynamixel actuator is limited by the values located in the RAM (Address 0x22,
0x23).
Packet after receiving an Instruction Packet.
. The maximum torque output for the Dynamixel actuator. When this value
Address16
. Sets the Dynamixel actuator’s operating angle range. The Goal
Returning the Status Packet
0
1Respond only to READ_DATA instructions
2
Do not respond to any instructions
Respond to all instructions
14
DYNAMIXEL
Address 0X11 Alarm LED
Address 0X12 Alarm Shutdown
T his function operates following the “OR” logical operation of all bits. However, unlike
Address 0x14~0x17 Calibration
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.
. If the corresponding Bit is set to 1, the LED blinks when an Error occurs.
BitFunction
Bit 70
Bit 6If set to 1, the LED blinks when an Instruction Error occurs
Bit 5If set to 1, the LED blinks when an Overload Error occurs
Bit 4If set to 1, the LED blinks when a Checksum Error occurs
Bit 3If set to 1, the LED blinks when a Range Error occurs
Bit 2If set to 1, the LED blinks when an Overheating Error occurs
Bit 1If set to 1, the LED blinks when an Angle Limit Error occurs
Bit 0If set to 1, the LED blinks when an Input Voltage Error occurs
This function operates following the “OR” logical oper ation of all bits. For examp le, 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.
. If the corresponding Bit is set to a 1, the Dynamixel actuator ’s torque
will be turned off when an error occurs.
BitFunction
Bit 70
Bit 6
If set to 1, torque off when an Instruction Error occurs
Bit 5
If set to 1, torque off when an Overload Error occurs
Bit 4
If set to 1, torque off when a Checksum Error occurs
Bit 3
If set to 1, torque off when a Range Error occurs
Bit 2
If set to 1, torque off when an Overheating Error occurs
Bit 1
If set to 1, torque off when an Angle Limit Error occurs
Bit 0
If set to 1, torque off when an Input Voltage Error occurs
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.
. 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
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 t urns 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.
CW
Goal Position
CCW
CCW
Y axis:Output Torque
A : CCW Compliance Slope(Address0x1D)
B : CCW Compliance Margin(Address0x1B)
C : CW Compliance Margin(Address0x1A)
D : CW Compliance Slope (Address0x1C)
E : Punch(Address0x30,31)
A
B
E
E
CD
X axis:Position Error
CW
Address 0X1E,0x1F Goal Position Requested angular position for the Dynamixel actuator out put t o move to.
Setting this value to 0x3ff moves the output shaft to the position at 30 0°.
(Goal Position = 0x1ff)
150°
CCW
CW
(Goal Position = 0x3ff)
300°
300~360°
Invalid Angle
0°
(Goal Position = 0)
16
DYNAMIXEL
Address 0x20,0x21 Moving Speed. Sets the angular velocity of the output moving to the Goal Position.
Address 0x24,0x25 Present Position
Address 0x26,0x27 Present Speed
Address 0x28,0x29 Present Load
Load Direction = 0 : CCW Load, Load Direction = 1: CW Load
Address 0x2A Present Voltage. The voltage currently applied to the Dynamixel actuator. The value is
Address 0x2B Present Temperature. The internal temperature of the Dynamixel act uator in Degrees
Address 0x2C Registered Instruction
Address 0x2E Moving.
Address 0x2F Lock. If set to 1, only Address 0x18 to 0x23 can be written to and other areas cannot.
Address 0x30,0x31 Punch. The minimum current supp lied to the motor during o peration. T he initial value is
Endless Turn
RX-28
Setting this value to its maximum value of 0x3ff moves the output with the maximum
angular velocity which depends on the level of po wer 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 cont rol is applied.)
. Current angular position of the Dynamixel actuator output.
. Current angular velocity of the Dynamixel actuator output.
. The magnitude of the load on the operating D yna mixel act uator. Bit 10 is
the direction of the load.
BIT 15~11109876543210
Value0Load DirectionLoad Value
10 times the actual voltage. For example, 10V is represented as 100 (0x64).
Celsius.
. 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.
Set to 1 when the Dynamixel actuator is moving by its own power.
Once locked, it can only be unlocked by turning the power off.
set to 0x20 and its maximum value is 0x3ff.
If both values for the CW Angle Limit and the CCW Angle Limit are set t o 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
DYNAMIXEL
Goal Speed Setting
Range
RX-28
BIT 15~11109876543210
Value0Turn DirectionSpeed Value
Turn Direction = 0 : CCW Direction Turn, Load Direction = 1: CW Direction Turn
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.
The returned Status Packet will be as the following.
The data read is 0x20. Thus the current inte rnal temperature of the Dynamixel actuat or
is approximately 32°C (0X20).
20
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)
Instruction 0X04
Parameter1
Parameter2 1st data to be written
Parameter3 2nd data to be written
Parameter N+1 Nth data to be written
Starting address of the location where the data is to be written
4-3-2. ACTION
Function
Length 0X02
Instruction 0X05
Parameter
Broadcasting The Broadcast ID (0XF E) is used when sending ACTION instructions to more t han two
Triggers the action registered by the REG_WRIT E instruction
NONE
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.
Dynamixel actuators. Note that no packets are returned by this operation.
21
DYNAMIXEL
RX-28
4-4. PING
Function
Length 0X02
Instruction 0X01
Parameter
Example 3 Obtaining the status packet of the Dynamixel actuator with an ID of 1
Changes the control table values of the Dynamixel actuator to the Factor y Default Value
settings
NONE
22
DYNAMIXEL
The returned Status Packet is as the following
Status Packet : 0XFF 0XFF 0X00 0X02 0X00 0XFD
ID LENGTH ERROR CHECKSUM
RX-28
Note the ID of this Dynamixel actuator is now changed to 1 after the RESET instruction.
4-6. SYNC WRITE
Function
ID
Length
Instruction 0X83
Parameter1
Parameter2 The length of the data to be written (L)
Parameter3 The ID of the 1st Dynamixel actuator
Parameter4 The 1st data for the 1st Dynamixel actuator
Parameter5 The 2nd data for the 1st Dynamixel actuator
…
Parameter L+3 The Lth data for the 1st Dynamixel actuator
Parameter L+4
Parameter L+5 The 1st data for the 2nd Dynamixel actuator
Parameter L+6
…
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
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.
0XFE
(L + 1) * N + 4 (L: Data length for each Dynamixel actuator, N: The number of Dynamixel
actuators)
Starting address of the location where the data is to be written
Data for the 1st Dynamixel actuator
The ID of the 2nd Dynamixel actuator
The 2nd data for the 2nd Dynamixel actuator
Data for the 2nd Dynamixel actuator
Dynamixel actuator with an ID of 1: to position 0X220 with a speed of 0X360
23
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 0 X00 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
DYNAMIXEL
RX-28
5. Example
For the following examples, we assume a Dynamixel act uator 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 w ith
You can verify the Torque Enabled status by trying to move the o utput of th e actuat or by
hand.
Example 17 Setting the Compliance Margin to 1 and Compliance Slope to 0x40 for a
Dynamixel actuator with an ID of 0
Compliance
The Angle Error and Torque Output can be represented with the following graph.
Goal Position CW
CCW
CW
X:Angle Error
CCW
Even if the position deviates a little from th e goal position in the CW direction, a large
amount of torque is generated in the CCW direction to compens ate for this. However,
since inertia must be considered, a realistic implem entation differs from this approach.
Considering this, the given conditions can be represented by the following graph.
CW Goal Position
CCW
Output Torque
CCW
CW
Angle(Position)
A
B
D C
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°)
RS485 UART RS485 UART is a serial communication prot ocol where both TxD and RxD cannot be
used at the same time. This method is generally used when many d evices 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 direct ion to
input mode, and only when it is transmitting an Instruction Packet, it changes the
direction to output mode.
Return Delay Time 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 chan ge the Direction Port to
input mode during the Return Delay Time after sending an instruction packet.
Tx,Rx Direction 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 sho wn below.
TxDByte(byte bData)
{
while(!TXD_BUFF E R_READY_BIT); //wait until data can be loaded.
SerialTxDBuffer = bData; //data load to TxD buffer
}
RS485 Direction Output Duration
Instruction PacketStatus Packet
Return Delay Time
31
DYNAMIXEL
The following is an example program that sends an Instructi on Packet.
LINE 1 DIRECTION_PORT = TX_DIRECTION;
LINE 2 TxDByte(0xff);
LINE 3 TxDByte(0xff);
LINE 4 TxDB yte(bID);
LINE 5 TxDByte(bLength);
LINE 6 TxDB yte(bInstruction);
LINE 7 TxDByte(Parameter0); TxDByte(Parameter1); …
LINE 8 DisableInterrupt(); // interrupt should be disable
LINE 9 TxDByte(Checksum); //last TxD
LINE 10 while(!TXD_SHIFT_REGISTER_EMPTY_BIT); //Wait till last data bit has been sent
LINE 11 DIRECTION_PORT = RX_DIRECTION; //Direction change to RXD
LINE 12 EnableInterrupt(); // enable interrupt again
Pleas e note t he important lin es between LI NE 8 and LINE 12. Line 8 is necessary since
Byte to Byte Time
The delay time between bytes when sending an instruction packet. If the delay time is
RX-28
When changing the direction, the TXD_SHIFT_REGISTER_EMPTY_BIT must be
checked.
an interrupt here may cause a delay longer than the retur n delay time and corruption to
the front of the status packet may occur.
over 100ms, then the Dynamixel actuator re cognizes this as a communication problem
and waits for the next header (0xff 0xff) of a packet again.
Byte To Byte Time
The following is the source code of a program (Example.c) that accesses the Dynami xel
actuator using the Atmega 128.
32
DYNAMIXEL
C Language Example : Dinamixel access with Atmega128
/*
* The Example of Dynamixel Evaluation with Atmega128
* Date : 2005.5.11
* Author : BS KIM
*/
//Hardware Dependent Item
#define DEFAULT_BAUD_RATE 34 //57600bps at 16MHz
////// For CM-2 PLUS
#define RS485_TXD PORTE &= ~_BV(PE3),PORTE |= _BV(PE2)
#define RS485_RXD PORTE &= ~_BV(PE2),PORTE |= _BV(PE3)
/*
////// For CM-2
#define RS485_TXD PORTE |= _BV(PE2); //_485_DIRECTION = 1
#define RS485_RXD PORTE &= ~_BV(PE2);//PORT_485_DIRECTION = 0
*/
//#define TXD0_FINISH UCSR0A,6 //This bit is for checking TxD Buffer
int main(void)
{
byte bCount,bID, bTxPacketLength,bRxPacketLength;
PortInitialize(); //Port In/Out Direction Definition
RS485_RXD; //Set RS485 Direction to Input State.
SerialInitialize(SERIAL_PORT0,1,RX_INTERRUPT);//RS485