PWM does not work correctly

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Osta
Posts: 53
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 1:12 pm
Has thanked: 1 time
Been thanked: 3 times

PWM does not work correctly

Post 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.
Attachments
Proteus
Proteus
Proteus.jpg (161.22 KiB) Viewed 2785 times
Flowcode
Flowcode
FC_SET.jpg (36.98 KiB) Viewed 2785 times
BG.fcfx
Proj
(10.53 KiB) Downloaded 105 times

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 469 times

Re: PWM does not work correctly

Post 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?
Martin

Osta
Posts: 53
Joined: Thu Dec 10, 2020 1:12 pm
Has thanked: 1 time
Been thanked: 3 times

Re: PWM does not work correctly

Post by Osta »

I made an order for attiny 44
When I get her then I can check.

Osta
Posts: 53
Joined: Thu Dec 10, 2020 1:12 pm
Has thanked: 1 time
Been thanked: 3 times

Re: PWM does not work correctly

Post by Osta »

The delay in one second in Proteus was confirmed.
But PWM does not work right!
Attachments
BG.fcfx
(11.1 KiB) Downloaded 103 times
1S.jpg
1S.jpg (111.04 KiB) Viewed 2735 times

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 469 times

Re: PWM does not work correctly

Post 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.
Martin

Osta
Posts: 53
Joined: Thu Dec 10, 2020 1:12 pm
Has thanked: 1 time
Been thanked: 3 times

Re: PWM does not work correctly

Post by Osta »

Many thanks!
With gratitude Osta.

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 469 times

Re: PWM does not work correctly

Post 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.
Martin

Post Reply