Robotis Dynamixel RX-64 Automobile Electronics User Manual


 
31
DYNAMIXEL
RX-64
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;
LINE 2 TxDByte(0xff);
LINE 3 TxDByte(0xff);
LINE 4 TxDByte(bID);
LINE 5 TxDByte(bLength);
LINE 6 TxDByte(bInstruction);
LINE 7 TxDByte(Parameter0); TxDByte(Parameter1); …
LINE 8 DisableInterrup t(); // 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
Please note the important lines bet ween LI NE 8 and LINE 12. Line 8 is n ecessary since
an interrupt here ma y cause a delay longer than the retur n delay time and corruption t o
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.
The following is the source code of a progra m (Example. c) that accesses t he Dynami xel
actuator using t he Atmega 128.
0xFF
0xFF
ID
Length
Byte To Byte Time