basic doubts regarding High speed pwm module in dsPIC33EP controllers

Thread Starter

ak52

Joined Oct 15, 2014
197
Hello everyone,
I am trying the in-built High speed PWM module of the dsPIC33EP and I have a few basic questions regarding this module.
1.How is PTPER calculated?
Currently I am using this as my reference
PTPER = (Fosc/(F_pwm*prescaler)) – 1
Is this correct or is there any other formula to use.
[edit] I am reffering to the "-1" which is missing in the high speed pwm manual.[/edit]

2.Regarding setting the duty cycle, Am I right in assuming that the maximum value the MDC register would count is the value in the PTPER register?
For example if PTPER is 5000, then for 50% duty cycle the value in MDC register should be 2500?

3.I am trying to drive an H bridge circuit; I have seen many recommending to use the module in complementary mode. Is this an absolute necessity to use complementary mode when driving an H bridge?


Thanks in advance,
Arun
 
Last edited:

JohnInTX

Joined Jun 26, 2012
4,629
I don't know for sure on this one and *crickets* from others so..

I'd submit a ticket on the uCHIP support site here. If you don't have an account its easy to create then go to My Tickets and ask away. For questions like this, you'll usually get some help within 24hrs plus, once a ticket is submitted, you'll get a phone contact.

Sorry I can't answer your question directly.
EDIT but if I were to guess, I'd say that the '-1' is correct. Its present in the other uCHIP PWMs I've used.. For question 2, that's the way the 8 bit stuff works - the period is some number of Tcyc*prescalers*PR2(a register value) and the duty cycle setting is some fraction of that absolute number of counts.

Good luck.
 
Last edited:

BobTPH

Joined Jun 5, 2013
4,298
Your formula looks correct.

You would use complementary mode if your H-bridge requires complementary inputs.

Bob
 

Thread Starter

ak52

Joined Oct 15, 2014
197
Thank you bobTPH,apologies for such a late response.
yeah i figured i needed to use complementary mode only,got it working now. :)
 
Top