by lucrece_lu » Tue May 19, 2009 4:47 am
by lucrece_lu
Tue May 19, 2009 4:47 am
RoBoard can connect with AX-12 via COM3 (short TX & RX) or COM4.
Using COM3, we will receive every packet that we send, before receiving the return packet of AX-12.
And using COM4, we must switch the RTS state to control the direction of the data line (i.e., TXRX4 pin); in particular, we should first set RTS = 1 to send the command packet, and, after ensuring that the packet has been sent out by H/W, we should set RTS = 0 to receive the return packet of AX-12.
In WinXP, it is not suggested to use COM4. This is due to the following
facts: 1. it is difficult in WinXP to ensure whether all data have been flushed out by H/W using standard Win32 API; 2. it is also difficult to guarantee the correct timing for switching RTS because the timing may be affected by thread/process context-switching. The sample code provides some heuristics to tackle the two issues.
The sample code assumes that AX-12's ID = 01 and its buadrate = 115200.
sample code download, for COM3 and COM4
http://www.roboard.com/files/code/RoBoa ... dAX-12.zip
http://www.roboard.com/files/code/RoBoa ... dAX-12.zip
RoBoard can connect with AX-12 via COM3 (short TX & RX) or COM4.
Using COM3, we will receive every packet that we send, before receiving the return packet of AX-12.
And using COM4, we must switch the RTS state to control the direction of the data line (i.e., TXRX4 pin); in particular, we should first set RTS = 1 to send the command packet, and, after ensuring that the packet has been sent out by H/W, we should set RTS = 0 to receive the return packet of AX-12.
In WinXP, it is not suggested to use COM4. This is due to the following
facts: 1. it is difficult in WinXP to ensure whether all data have been flushed out by H/W using standard Win32 API; 2. it is also difficult to guarantee the correct timing for switching RTS because the timing may be affected by thread/process context-switching. The sample code provides some heuristics to tackle the two issues.
The sample code assumes that AX-12's ID = 01 and its buadrate = 115200.
sample code download, for COM3 and COM4
http://www.roboard.com/files/code/RoBoa ... dAX-12.zip
http://www.roboard.com/files/code/RoBoa ... dAX-12.zip