PIC24EP512GU810 PWM problems

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

electronix
Posts: 58
Joined: Sat Aug 22, 2009 5:45 pm
Has thanked: 17 times
Been thanked: 7 times
Contact:

PIC24EP512GU810 PWM problems

Postby electronix » Wed Sep 26, 2018 3:28 pm

Hi all.
I have been trying to use a PWM component in a project but no matter what I put in the duty cycle it always stays 50%, Has anyone else experienced the same thing or am I missing something?
Have tried both 10-bit setting and 8-bit setting and the result stays the same...50%

Regards

Nick

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

Re: PIC24EP512GU810 PWM problems

Postby Benj » Wed Sep 26, 2018 4:39 pm

Hi Nick,

Please can you post your project file so we can see what you're doing and hopefully suggest a fix.

Also is the problem limited to hardware or simulation or both?

electronix
Posts: 58
Joined: Sat Aug 22, 2009 5:45 pm
Has thanked: 17 times
Been thanked: 7 times
Contact:

Re: PIC24EP512GU810 PWM problems

Postby electronix » Wed Sep 26, 2018 4:54 pm

Hi Ben.
Thanks a lot for looking into it, maybe I´m just not seeing the problem.

I have tried it on hardware.
Here´s the file

Best Regards
Nick
Attachments
24EP512GU810_PWM.fcfx
(18.64 KiB) Downloaded 45 times

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

Re: PIC24EP512GU810 PWM problems

Postby Benj » Wed Sep 26, 2018 5:02 pm

Hi Nick,

I think I see what's going wrong.

When you enable the PWM it will automatically jump back to the period and prescaler values from the properties.

So if you change the period and or prescaler before enabling the PWM output then these changes will be lost.

I would recommend enabling the PWM and then calling the ChangePeriod and SetDutyCycle10Bit macros and seeing how you get on.

If this still has issues then are you running 7.3 and have you applied the latest post 7.3 updates from here.
https://www.matrixtsl.com/mmforums/viewtopic.php?f=63&t=19743
These users thanked the author Benj for the post:
electronix (Thu Sep 27, 2018 1:06 pm)
Rating: 5.26%
 

electronix
Posts: 58
Joined: Sat Aug 22, 2009 5:45 pm
Has thanked: 17 times
Been thanked: 7 times
Contact:

Re: PIC24EP512GU810 PWM problems

Postby electronix » Thu Sep 27, 2018 11:39 am

Hi Ben.
:oops: :shock: ....
I cant belive I just didn´t see that :oops:

Thank you for, as always, excellent support Ben :D

Best Regards
Nick
These users thanked the author electronix for the post:
Benj (Thu Sep 27, 2018 1:28 pm)
Rating: 5.26%