Page 1 of 1

PWM does not work correctly

Posted: Tue Nov 30, 2021 11:58 am
by Osta
Hello everyone!
I use Attiny44 , Flowcode 9.2.
In the emulator, it works true and in Proteus and iron works not right!
Examples of work apply.

Re: PWM does not work correctly

Posted: Tue Nov 30, 2021 3:19 pm
by medelec35
Hi, I don't have the Attiny44, so I won't be able to help much.
Does the hardware match the simulation or you have not tried it on hardware yet?
Can you try the one-second flasher test on your hardware to make sure the hardware is running at the correct speed?

Re: PWM does not work correctly

Posted: Tue Nov 30, 2021 8:33 pm
by Osta
I made an order for attiny 44
When I get her then I can check.

Re: PWM does not work correctly

Posted: Wed Dec 01, 2021 9:10 am
by Osta
The delay in one second in Proteus was confirmed.
But PWM does not work right!

Re: PWM does not work correctly

Posted: Wed Dec 01, 2021 12:29 pm
by medelec35
I have just looked into this.
When you compile you will see a warning:

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\AVR\AVR_CAL_PWM.c:495:3: warning: #warning "Period control register not available on target device, period will default to 255 + 1" [-Wcpp]
  #warning "Period control register not available on target device, period will default to 255 + 1"
Therefore, to get a PWM 50% duty cycle you need to set the duty to 127.
Unfortunately, that is the disadvantage of AVR.

Re: PWM does not work correctly

Posted: Wed Dec 01, 2021 6:56 pm
by Osta
Many thanks!
With gratitude Osta.

Re: PWM does not work correctly

Posted: Sat Dec 04, 2021 2:46 pm
by medelec35
As limited PWM is caused by the limitations of AVR, I have moved topic from the bugs section.
If you believe this is resolved can please add [Resolved] to the start of your subject.