Robotis DX-117 Automobile Electronics User Manual


 
29
DYNAMIXEL
DX-Series
When changing the direction of RS-485, the TXD_SHIFT_REGISTER_EMPTY_BIT
must be checked.
The following is an example program that sends an Instruction Packet.
LINE 1 PORT_485_DIRECTION = 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 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 PORT_485_DIRECTION = RX_DIRECTION; //485 direction change to RXD
LINE 12 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.
The following is the source code of a program (Example.c) that accesses the Dynamixel
actuator using the Atmega 128.
0xFF
0xFF
ID
Length
Byte To Byte Time