Arduino multichannel PWM: can I do this?

Your source for all things Atmel.

Moderator: phalanx

Post Reply
Posts: 128
Joined: Mon Jun 04, 2007 9:20 pm

Arduino multichannel PWM: can I do this?

Post by equipoise » Mon Feb 15, 2010 9:41 am

Can I use analogWrite() PWM simultaneously on multiple pins without any timing problems? If there are timing issues, does their badness depend on the number of different PWM channels I use? The duty cycles on each pin will be different from each other. And if it's not possible to do this without timing badness, I'm interested in any suggestions about alternatives you might have.

I'm interested in learning about this behavior for both the Duemilanove (6 PWM channels) and the Mega (13 PWM channels).


-- equipoise

Posts: 155
Joined: Fri Mar 28, 2008 7:36 am

Post by Liencouer » Tue Feb 16, 2010 2:14 pm

I would guess (although I have not dug too deeply) that analog write sets up a timer with a constant frequency and then varies the duty cycle for each pin by comparing the desired value vs the count register. as such, i suspect you can use the analog writes as if they were independent of each other.

Post Reply