Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Decode Servo PWM Signals

2005-04-26 by Dennis Clark

I handled it as an interrupt based on a 10us timer rollover.  At 10us 
tics a 1ms to 2ms (+ or - a bit) can be handled as an 8 bit number from 
100 to 200.  Perhaps not that greatest resolution, but adequate to my 
needs.  You could set the timer to give you a 5us interrupt for twice 
that resolution, but you might have to code it in assembler, depending 
upon your compiler.  I found that gcc did an ATROCIOUS optimization job, 
YMMV.

I read 2 channels in a 4 step state machine.  You might do better to use 
a couple of the IO lines that have interrupts tied to them and use the 
hardware to time it - You'd have to change the IRQ sense upon each 
upward transition.

DLC

Joel Haasnoot wrote:
> 
> Hi
> I would like to decode PWM signals, for servos, such as those on model 
> pr rc airplanes. Does anybody have any experience, hints, tips, code, 
> google keywords or anything of the like?
> 
> Joel
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 


-- 
---------------------------------------------------------------------
* Dennis Clark  dlc@frii.com http://www.techtoystoday.com             *
* "Programming and Customizing the OOPic Microcontroller" Mcgraw-Hill *
---------------------------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.