On Sun, Nov 11, 2012 at 03:45:22PM -0800, Marc MERLIN wrote:
> Howdy,
>
> I'm learning more about interrupts and timers, and amont other things read
> on
http://letsmakerobots.com/node/28278 that for PWN:
> Pins 5 and 6: controlled by timer0
> Pins 9 and 10: controlled by timer1
> Pins 11 and 3: controlled by timer2
Actually I had a followup on this.
I noticed that my ardumoto shield uses PWM 3 and 11 which means
Timer2 is gone.
Stupid question: is there a valid reason for a shield to not use
PWM on pins 5 and 6 since this can be done on Timer0 which is generally not
usable for 3rd party code anyway?
I'm thinking about cutting the traces on my ardumoto
https://www.sparkfun.com/products/9815
to redirect the PWM pins to 5 and 6, so that I can at least get Timer2
back, giving me the option of either having 2 extra PWM pins, or a Timer
interrupt for doing something cool like talking to PNG sensors in the
background with
http://code.google.com/p/arduino-new-ping/
(it uses Timer2 if you use its interrupt mode).
On Mon, Nov 12, 2012 at 02:33:06PM +1100, Zac Faragher wrote:
> Hi Marc,
>
> If the Aiko code sets the timer interrupt registers to something very
> specific, you may not be able to get what you're after without
> changing them, which of course defeats the entire purpose.
I'm not sure if I was going to change the Aiko Library, but if it stops me
from doing PWM on pins 9 and 10, with an ATMega, I have other PWM pins, so
it's not a big deal.
> While it is certainly possible to get them to work together, you will
> need to be very sure of what you are changing and how it may affect
> how other pieces of code run. You may also need to change things like
> timer interrupt subroutines in order to add the functionality you're
> after, and you may or may not feel comfortable doing this.
If you meant sharing an interrupt (I wsan't quite sure which bit you were
replying to), I agree. That's probably more than what I'd want to chew :)
Thanks for your answers,