Hi, I have a problem. I use atmega328p and need changeable pwm signal. (example 150Hz-500Hz) Therefore, I use 16 bit pwm and choose "phase&frequency correct mode". My code:
This is not 150 hz. This is 150,00094 Hz.
ICR1 must be 53333,333333333... for 150Hz(fpwm=fmcu/2.ICR1, fmcu=16MHz) but this is impossible. I have a machine run with duty cycle on 150Hz.
I have another machine run with duty cycle on 500Hz, so I have to use microcontroller but how can I do changeable without a fraction frequency.