Log in

View Full Version : 18F2431 PCPWM Module Advice



Aussie Barry
- 30th June 2012, 12:25
Hi All,

Has anyone played with the Power Control PWM (PCPWM) module on a 18F2431?
I am working towards a program to run a 1500W 180Vdc treadmill motor with bi-directional control using high voltage MOSFET's in H-bridge configuration. From what I have read of the datasheet so far, the '2431 should be able to do it, no problems.

Any hints or tips from previous success stories would be greatly appreciated.

Cheers
Barry
VK2XBP

sayzer
- 1st July 2012, 10:45
There are some great examples in this forum.

Use search box.

Aussie Barry
- 1st July 2012, 11:58
Thanks Sayzer.

I thought I had searched and found just about everything on the forum regarding this device.
I searched again (different search) and found more - specifically related to PCPWM function from Bruce.

Once again I return my "Newbie Crown" to my head... :(

Cheers
Barry
VK2XBP

boroko
- 2nd July 2012, 09:28
Here is another and a link from there:

I had the same problem finding help with the PCPWM
http://www.picbasic.co.uk/forum/showthread.php?t=16647

Bo

Aussie Barry
- 16th July 2012, 13:10
Hi All,

Just a quick update on my project.
As stated in my initial post, I am working towards a program to run a 1500W 180Vdc treadmill motor with bi-directional control using high voltage MOSFET's in H-bridge configuration. I am pleased to advise that I have successfully coded my '2431 to give forward, reverse and stop functions to the H-bridge via three momentary action switches using INTx interrupts (Darrels DT_INTS-18 rountines). PWM frequency is set to just under 8kHz and the duty cycle is varied by reading a pot setting via A/D. I can adjust dead time control as required - currently set at 1uS.

As for the hardware, I have made the power board PCB but it still needs to be drilled, populated and tested. For the time being, I will continue my PIC development using the breadboard. Interface to the powerboard should be pretty straight forward.

Lots more to do but I am progressing well and learning heaps :)

I will post some pictures, scope captures and code snippets once I get the hardware up and running.

Cheers
Barry
VK2XBP

embsysdev
- 14th November 2012, 08:33
I hope it is ok to append to this thread,rather than start a new one for a similar issue.
I am trying to use the PCPWM module in my 18F2431.The PIC is clocked at 20MHz.I am able to set up the frequency I need correctly (50Hz;20mS).I am unable to calculate the duty cycle.Assuming a 12bit resolution,I set , for a 25% duty cycle:
PDC0L=0x00;
PDC0H=0x04;
This gives me 3mS not 5mS. Extrapolating from this, I understand am getting a resolution of 12 ~ 13 bits resolution.I read the other thread referenced in this one,but I could not find any ideas.Is there anyway to know how to calculate the duty cycle,or resolution of the PWM exactly ?
I would post my code but it is in C :o. I hope I can get some suggestions,since there are quite a few experts for 18F2431 here.