Hi guys,
I just bought the ATTiny85 Board from Digispark.
I would like to have a Pin with a PWM Frequency of around 200Hz.
Googling gave me a lot of pages but no real explaination what or how I am changing the frequency.
Can someone explain this topic to me for Noobs when it comes to microprozessors ?
Some Coode examples would also help a lot.
Thanks for your help and time.
Start by downloading and reading the ATtiny85 Datasheet.
When using a Timer/Counter the PWM frequency depends on FOUR things:
- The system clock speed.
- The pre-scale divider applied to the system clock to get the timer clock.
- The value of 'TOP', the count at which the counter resets to zero. For 8-bit PWM, 'TOP' is 255. If you don't mind less PWM resolution you can use a lower value of TOP to get higher PWM frequency. If you have a 16-bit timer available, you can get higher PWM resolution (up to 65535 steps) at the sacrifice of PWM frequency.
- Whether the Fast PWM (count up only) mode is used or one of the PWM modes that count both up and down. Regular PWM runs at half the frequency of Fast PWM.
I don't really understand the syntax.
Can someone explain that to me ?
Read the spec sheet, or look at Gammon's page for info. If you do not understand the information in those links, it seems like you want someone to do your work and you may find this in gigs and collabs.