New PMW code for Uno/AVR targets
Posted: Fri Mar 21, 2025 10:12 pm
The new code allows you to directly set the frequency (PB0 to PB5 = 0.24Hz to 158KHz, PD0 to PD7 = 244Hz to 158KHz) and duty cycle from 0 to 100% in 1% steps.
I plan to add simulation.
If anyone would like to test the code on an uno for example, the I would appreciate feedback comparing to existing PWM component.
You can find an example here
Just bear in mind that you will need to set you own pin within the code, if you don't want to use B2
Timer1 is better as its 10bit, but it can only be used for B0 to B5
You must only have timer1 or timer2 code enabled at any one time.
If both enabled there will be an error is only using annotated functions
Thank you
I plan to add simulation.
If anyone would like to test the code on an uno for example, the I would appreciate feedback comparing to existing PWM component.
You can find an example here
Just bear in mind that you will need to set you own pin within the code, if you don't want to use B2
Timer1 is better as its 10bit, but it can only be used for B0 to B5
You must only have timer1 or timer2 code enabled at any one time.
If both enabled there will be an error is only using annotated functions
Thank you