by JonHylands » Fri Jan 12, 2007 10:05 pm
by JonHylands
Fri Jan 12, 2007 10:05 pm
Well, its complicated
It basically comes down to two things - because the Bioloid bus does RS-232 Tx and Rx on the same wire, you need an RS-232 system that is compatible with that, from an electrical point of view. Once you have that, you need to deal with the timing aspect of it.
The way the bus works, the master (in our case, the PC) sends a packet down the Tx line of the bus. One of the slaves (an AX-12) will respond with a response packet. The turnaround time is specified by register 5 in the control table, which is "Return Delay Time". The default response time is 500 micro-seconds, which is half a millisecond.
So, in that time, in order for the bus to work, the master has to switch the bus line from transmit mode to receive mode. You can do that with a bus switch, but you have to know exactly when to do the switch.
A UART in a PC is a complex beast, and the reason it can do such high speeds is because you basically give it a bunch of bytes to send, and say "send it". You (as the programmer) have no idea when those bytes actually get sent down the pipe, so you have no idea what 500 micro-second window to change your bus switch over.
With a micro-controller, you're basically working at the hardware/driver level, so you can get an interrupt when the UART is done shifting the bytes down the line.
That, in a nutshell, is why you need a micro-controller to do this...
- Jon
Well, its complicated
It basically comes down to two things - because the Bioloid bus does RS-232 Tx and Rx on the same wire, you need an RS-232 system that is compatible with that, from an electrical point of view. Once you have that, you need to deal with the timing aspect of it.
The way the bus works, the master (in our case, the PC) sends a packet down the Tx line of the bus. One of the slaves (an AX-12) will respond with a response packet. The turnaround time is specified by register 5 in the control table, which is "Return Delay Time". The default response time is 500 micro-seconds, which is half a millisecond.
So, in that time, in order for the bus to work, the master has to switch the bus line from transmit mode to receive mode. You can do that with a bus switch, but you have to know exactly when to do the switch.
A UART in a PC is a complex beast, and the reason it can do such high speeds is because you basically give it a bunch of bytes to send, and say "send it". You (as the programmer) have no idea when those bytes actually get sent down the pipe, so you have no idea what 500 micro-second window to change your bus switch over.
With a micro-controller, you're basically working at the hardware/driver level, so you can get an interrupt when the UART is done shifting the bytes down the line.
That, in a nutshell, is why you need a micro-controller to do this...
- Jon