PWM problems

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

PWM problems

Post by Bachman »

Hello!

I made a little PWM test and i found two problems. See attached program.

First problem: When i power up the controller, after the PWM enable, it's turns on as full duty until it's get another command.
Trun_ON_1.jpg
Trun_ON_1.jpg (69.87 KiB) Viewed 4209 times
Turn_ON_2.jpg
Turn_ON_2.jpg (65.27 KiB) Viewed 4209 times
Attachments
PWM_Test.fcfx
(5.77 KiB) Downloaded 265 times

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

Re: PWM problems

Post by Bachman »

Second problem: Set the duty to 255, simulation shows az 100 %, but in the real HW, it's not 100 %.
Duty_255_1.jpg
Duty_255_1.jpg (65.37 KiB) Viewed 4208 times
Duty_255_2.jpg
Duty_255_2.jpg (64.54 KiB) Viewed 4208 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PWM problems

Post by Benj »

Hello,

I can maybe see why you are not getting 100% duty on. You are writing to the PWM duty register even when the duty remains constant so maybe this is causing the problem.

If you move the SetDutyCycle call into the decision icons yes branches then does this solve the problem?

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

Re: PWM problems

Post by Bachman »

It's doesn't matter, where is the SetDutyCycle command. After the PWM enabled, the output goes to full duty until it's got another SetDutyCycle command. I've tested it on Flowcode 5, on that version, only the second problem exists, set duty to 255 is not 100 % duty on the HW.

Post Reply