ATTiny85 PWM Pins

Just a quick question, most diagrams show two PWM pins on an ATTiny85 as per the one shown below, pins 0 & 1.

Some say there are three PWM pins, 0, 1 & 4.

Can someone please clarify which is correct?

Thank you in advance.

Microchip should be able to clarify. From the datasheet:


This shows that pins 2, 3, 5, 6 all have PWM capability. Note I'm using the pin numbers that correspond to the numbers inside the rectangle in your picture. These are the numbers 3, 4, 0, 1 respectively in the cyan circles in your pic.

Whether all these pins will output PWM when using Arduino's analogWrite() function, I can't say. It may involve manipulation of the Timer registers to get output on some of these pins. I figure if you want/need to limit yourself to this small chip, you're also prepared to expend the effort to optimize the code for it (isn't that the fun of it, anyway!)

PS: note that this doesn't mean that all 4 pins can have a PWM output independent of each other. Truly independent PWM outputs are limited to 2 pins, but you have choice out of 4 physical pins where you want to map this output to.

1 Like

Many thanks for your reply, I don't know enough to start manipulating Timer registers so will stick to the two pins shown!

Safe bet! You're welcome; good luck with your project.

http://w8bh.net/avr/TrinketTimers.pdf

Thank you for the link, I will have a good read at it later.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.