Attiny85 Timer0 and PWM

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Viktor74
Posts: 29
http://meble-kuchenne.info.pl
Joined: Sun Sep 22, 2024 9:13 pm
Has thanked: 5 times
Been thanked: 4 times

Attiny85 Timer0 and PWM

Post by Viktor74 »

Greetings all friends! Help me to understand the macro of pulse width modulation. I need the PWM to work at the specified time, but it seems to me that the timer is not working correctly. It switches very quickly, perhaps the divider is not working correctly. As a master oscillator, I use the RC of the on-chip oscillator at 1 MHz. Here is a small example to understand how to configure it correctly.
Attachments
time_pwm.fcfx
(14.13 KiB) Downloaded 29 times

medelec35
Matrix Staff
Posts: 1956
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 657 times

Re: Attiny85 Timer0 and PWM

Post by medelec35 »

Hello.
Have you set the configuration settings to run at 1MHz?
The First thing I would recommend is create a one sec flash timer to check hardware is working as expected.
if the LED or port is toggling at the correct duration, then the PWM can be revisited.
Martin

Viktor74
Posts: 29
Joined: Sun Sep 22, 2024 9:13 pm
Has thanked: 5 times
Been thanked: 4 times

Re: Attiny85 Timer0 and PWM

Post by Viktor74 »

Hi Martin! Thank you very much! I'm a little confused in the simulator, it seems to work, but in practice I can't check it under a free licence, it doesn't compile.
Attachments
time_pwm.fcfx
(13.44 KiB) Downloaded 27 times
time_pwm.fcfx
(14.13 KiB) Downloaded 31 times

Post Reply