by freeforall » Sat Apr 28, 2007 7:58 pm
by freeforall
Sat Apr 28, 2007 7:58 pm
Hi,
Yes and here is the main function of the code I uploaded.
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 Initializing(RxInterrupt)
SerialInitialize(SERIAL_PORT1,DEFAULT_BAUD_RATE,0); //RS232 Initializing(None Interrupt)
gbRxBufferReadPointer = gbRxBufferWritePointer = 0; //RS485 RxBuffer Clearing.
sei(); //Enable Interrupt -- Compiler Function
TxDString("\r\n [The Example of Dynamixel Evaluation with ATmega128,GCC-AVR]");
//Dynamixel Communication Function Execution Step.
// Step 1. Parameter Setting (gbpParameter[]). In case of no parameter instruction(Ex. INST_PING), this step is not needed.
// Step 2. TxPacket(ID,INSTRUCTION,LengthOfParameter); --Total TxPacket Length is returned
// Step 3. RxPacket(ExpectedReturnPacketLength); -- Real RxPacket Length is returned
// Step 4 PrintBuffer(BufferStartPointer,LengthForPrinting);
bID = 5;
TxDString("\r\n\n Press any Key to continue"); RxD8();
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x08; //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);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
bID = 6;
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x05; //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);
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");
while(1);
}
Is there any chance that the problem comes from this code?
Thank you.
Hi,
Yes and here is the main function of the code I uploaded.
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 Initializing(RxInterrupt)
SerialInitialize(SERIAL_PORT1,DEFAULT_BAUD_RATE,0); //RS232 Initializing(None Interrupt)
gbRxBufferReadPointer = gbRxBufferWritePointer = 0; //RS485 RxBuffer Clearing.
sei(); //Enable Interrupt -- Compiler Function
TxDString("\r\n [The Example of Dynamixel Evaluation with ATmega128,GCC-AVR]");
//Dynamixel Communication Function Execution Step.
// Step 1. Parameter Setting (gbpParameter[]). In case of no parameter instruction(Ex. INST_PING), this step is not needed.
// Step 2. TxPacket(ID,INSTRUCTION,LengthOfParameter); --Total TxPacket Length is returned
// Step 3. RxPacket(ExpectedReturnPacketLength); -- Real RxPacket Length is returned
// Step 4 PrintBuffer(BufferStartPointer,LengthForPrinting);
bID = 5;
TxDString("\r\n\n Press any Key to continue"); RxD8();
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x08; //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);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);
TxDString("\r\n TxD:"); PrintBuffer(gbpTxBuffer,bTxPacketLength);
TxDString("\r\n RxD:"); PrintBuffer(gbpRxBuffer,bRxPacketLength);
bID = 6;
gbpParameter[0] = P_GOAL_POSITION_L; //Address of Firmware Version
gbpParameter[1] = 0x00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0x05; //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);
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");
while(1);
}
Is there any chance that the problem comes from this code?
Thank you.