PDA

View Full Version : 18F2331 Advanced PWM Questions



JDM160
- 27th October 2005, 00:57
I am using a PIC 18F2331 and I'm trying to utilize the Power Control PWM module which has three independent PWM generators.

I need to be able to update the duty cycle of each PWM generator on the fly while running in free running mode (where the PWM output remains the same until a new duty cycle is given).

I am very new to this realm of bits, bytes and all, but somehow I have been writing successful intricate programs on the 12F series PICs. Anyhow, I digress.

Can someone please help me with the proper configuration lines for PIC BASIC PRO. I am having a hard time understanding exactly how to implement or issue the duty cycle to the PWM module.

The duty cycle registers have 14-bit resolution (???) PDC0 through PDC3. The datasheet is fairly vague (at least at my level of understanding) as to what command line must be issued and in what format to change or issue a duty cycle AND what range of numbers correspond to 0% to 100%.

The Pic BASIC Pro PWM and HPWM commands are useless for my application so please don't bother mentioning them. I need the PWM module to run independently of the code, and HPWM does not support more than 3 PWM modules (only the CCP channels).

I appreciate your help very much in advance...

JDM160
- 27th October 2005, 04:39
I believe I was making things harder on myself by choosing the wrong chip for my applicaton. I found some 16Fxxx chips that have 3 ccp pwm modules - which is what I needed to search for in the first place. This way I can use the HPWM effectively.

If anyone cares to reply to my origonal thread I would still appreciate it very much as I'm really trying to get a grip on this stuff.

Thanks all!!

sougata
- 31st October 2005, 18:50
Hi there,

I need to know the following details

1. PIC used

2. Clock Frequency

3. Intended PWM frequency (or range)

4. Dead time needed or not

And some detail of the actual application.


Regards

Sougata

ScaleRobotics
- 24th July 2010, 23:04
I am using a PIC 18F2331 and I'm trying to utilize the Power Control PWM module which has three independent PWM generators.


A bit late for you, but if anyone else has the same question, Bruce has an example here: http://www.picbasic.co.uk/forum/showthread.php?t=7095&p=43820#post43820 and ther is a wiki here: http://www.picbasic.co.uk/forum/content.php?r=229-Sine-wave-using-DT-interrupts