gnupic: PWM Fun
Subject:
Re: PWM Fun
From:
Scott Dattalo ####@####.####
Date:
22 Jan 2003 21:29:06 -0000
Message-Id: <Pine.LNX.4.44.0301221315060.31930-100000@ruckus.brouhaha.com>
On Wed, 22 Jan 2003, Jeff Jackowski wrote:
> I'm working on a device to emulate some old game console controllers. To
> support everything I want, I need 4 individually timed PWM outputs. I'm
> not an electronics expert, so I thought I'd ask here to find some
> alternatives.
>
> The PIC16F877 I've been using is too busy for me to figure a way for it
> to output the PWM. I've considered using 2 PIC's so one can concentrate on
> PWM. I can see how to do it, but it does make things a bit more complex.
> I've also considered using an Atmel megaAVR controller that can manage 4
> PWM outputs in hardware, but the part I was considering (ATmega128)
> doesn't seem to be supported by gcc yet, and I have no desire to code
> everything in assembly.
Check out
http://www.dattalo.com/technical/software/software.php
and particularly:
http://www.dattalo.com/technical/software/pic/pwm8.asm
This code will drive 8 PWMS simultaneously. I've got a new version that
does the same thing but allows you to easily update the Pulse Width.
For 8 pwms, it takes 23 cycles. For 4 it would only take 15 cycles.
That's very little overhead. The code reside in a timer 0 interrupt
handler.
Scott