AVR based 16 Channel RC servo driver

I would like to generate 16 channel R/C (radio control) servo motor signals (1ms-2ms) with 9 or 10 bits accuracy. These signals will drive an 16 R/C motors on a walking robot. Is there any C
(AVRgcc or CodeVisionAVR) code to realize this?
Pang Fu
nospam snipped-for-privacy@hotmail.com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
john snipped-for-privacy@NOSPAM.hotmail.com says...

Can you be specific on why you feel Imagecraft is more efficient compared to the Codevision compiler? I'm thinking about buying Codevision and I'd like to hear plus/minuses.
-- Jay.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Write some code and try the demo versions. Using AvrStudio to simulate the code operation, its easy to time the code execution using the timer in the 'processor' window. When I tried this, with my sample code I found the Imagecraft compiled code was smaller and executed about twice as fast as the some code compiled with codevision. Imagecraft have 45 day evaulation version, and I think codevision offer something similar.
AVR studio compatibility is something you should also investigate. I have heard that Imagecraft is better than the others in this regard, but only used codevision with Version 3 of avr sudio. Avr Studio 4.07 is not 100% stable though (can say the same for V3.56 also), so it is difficult to tell if the problem is with the compiler listing file compatilibility, or some bug in avr studio.
regards, Johnny.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Johnny wrote:

IMO it is not that simple ;-(
If you start all pulses at ones, you get trouble if some servos have (almost) equal pulse lengths.
The classic way to avoid this would be to send one pulse after the other. However, a servo requires a pulse every 20ms. So you can do at most 10 servos in sequence, no matter how hard you optimize the code.
I would suggest one of the following:
1) One interrupt every 20ms that starts all pulses. Another interrupt 1ms later, here you do a hand-timed loop that stops the pulses one by one. The drawback is that you are in a loop (with disabled interrupts) for 1ms, i.e. that you shouldn't use 19.2kBaud or higher for UART (or SPI).
2) Start pulses in turn every 1ms. Problem here is, that you don't get pulse lengths near 1ms and near 2ms.
The choice depends on the application.
BTW: Every interrupt (other than pulse generation) has to be interruptable to achieve the desired accuracy.
Jan-Hinnerk
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

On the other hand, if you have two timer compare registers, you can be sending two pulses at a time; this lets you run two sets of up to 10 servos each in the allotted 20ms, which is is enough to do what the original poster wanted.
10-bit accuracy corresponds to about 1us of pulse-length accuracy, or about 16 instructions at 16MIPS. As long as the interrupt latency has less jitter than that, it should be ok.
--
Wim Lewis < snipped-for-privacy@hhhh.org>, Seattle, WA, USA. PGP keyID 27F772C1

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Wim Lewis wrote:
[...]

You will get problems when both interrupts overlap, because you can only execute one ISR at a time. However, I'm not sure that 10-bit accuracy is needed (is the servo really able to act that accurate???)
@Pang Fu: Do you really mean 10-bit accuracy on the output variation, i.e. 1024 different servo positions?
Jan-Hinnerk
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Dear Jan-Hinnerk,
Yes, I did mean 9 bit for 512 and 10 bit for 1024 different servo positions. There are servo motors and other RC controlled gadgets working with this high accuracy.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Pang Fu wrote:

I have thought about servo control some time ago, but have never produced any code :-(
Jan-Hinnerk
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.