Go Down

Topic: Convert timer2 code to timer4 (Read 2244 times) previous topic - next topic

Claghorn

I'm porting my IR code from an Uno R3 to a Teensy (and I suppose in theory to a Leonardo as well), and I notice that the atmega32u4 doesn't have timer2. That puts a crimp in using it for PWM to generate the 38kHz IR signal. The 32u4 does have timer4 which supports 10 bit operation, but according to the datasheet can also be used in 8 bit mode. I suppose I need to compare the datasheets with a microscope to be sure, but I thought I'd ask if anyone knows how similar doing phase correct PWM output is with timer4 on the 32u4 versus timer2 on the 328p? (In general, all the timer stuff makes my brain hurt - there are too many modes described in too confusing a fashion in the datasheets :-).

Coding Badly


Does this help?
http://www.pjrc.com/teensy/td_libs_IRremote.html

Claghorn



Does this help?
http://www.pjrc.com/teensy/td_libs_IRremote.html



Yep, that should be just the reference I need. It does say it is using timer4 on the Teensy 2.0, which is what I also want to use. Thanks for the pointer (I should have looked on the teensy site to begin with).

Go Up