Page 1 of 1

PIC24EP512GU810 PWM problems

Posted: Wed Sep 26, 2018 3:28 pm
by electronix
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

Re: PIC24EP512GU810 PWM problems

Posted: Wed Sep 26, 2018 4:39 pm
by Benj
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?

Re: PIC24EP512GU810 PWM problems

Posted: Wed Sep 26, 2018 4:54 pm
by electronix
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

Re: PIC24EP512GU810 PWM problems

Posted: Wed Sep 26, 2018 5:02 pm
by Benj
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.
viewtopic.php?f=63&t=19743

Re: PIC24EP512GU810 PWM problems

Posted: Thu Sep 27, 2018 11:39 am
by electronix
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