Thankyou for your fast answer.. can you recommend me a mid range micro that can be used on this application?, dont you know if any dip 20 pin have 2 ccp modules? These will be a critical application so I need to do it with HPWM.. not with software..
Thankyou for your fast answer.. can you recommend me a mid range micro that can be used on this application?, dont you know if any dip 20 pin have 2 ccp modules? These will be a critical application so I need to do it with HPWM.. not with software..
As far as i remember, the smallest one with 2 CCP have 28 pins.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
problem with most single ECCP module is that you're restricted with only 1 duty cycle... but many output type, half-bridge, full-bridge etc etc.
But yeah, Microchip have tons of PIC model, i just didn't found one Flash type with 2 CCP under 28 pins. Sure there's chance that i missed a couple of models.
Last edited by mister_e; - 9th April 2008 at 01:42.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I already find a solution, as you say 18F1330 looks like the best model for PWM aplications. It have 18 pins and ADC, perfect for my project, but the microcode doesnt works with it as well as the other micros, when you try to use the HPWM, many errors occur..
I have been working on the project today, and finally it works, working directly with the registers, you can drive 3 different PWM at the time.
Lets see how the ADC works and if i can finish my project without any other problem.
Thankyou for all..
Hi.
Did you get anywhere with the PWM code for the 18F1330?
I don't think that you can use HPWM with this device as it's PWM module is completely different to the normal PWM module found in 16F chips. It requires many registers to be set manually.
Am currently working on this, but experiencing problems...
Andy
You have to acces direct to the registers, and configure the internal OSC to work with it..
The pwm duty cycle works with 14 bits, so you have to write directly the value on the PDC0L register for the less significant bits and the PDC0H for the more significant bits of the PWM 0 channel..
I hope these can help you, if you download the datasheet you will understand more the code that I wrote.. These is part of the code of my program:
OSCCON.6 = 1 'configure the internal oscilator to work at 4 MHz
OSCCON.5 = 1
OSCCON.4 = 0
OSCCON.1 = 1
PTCON0 = $00 ' configure frequency and the PWM sets
PTCON1 = $C0
PWMCON0 = $37
PWMCON1 = 0
PTPERL = $AA
PTPERH = $01
PDC0L = $FF ' Set the duty cycle for PWM 0
PDC0H = $00
PDC1L = $FF ' Set the duty cycle for PWM 1
PDC1H = $01
Hi, thanks for the reply.. I got it working in the end.
The thing that I was doing wrong was having a larger duty cycle value in PDC0L and PDC0H than the value in PTPERL and PTPERH. Since the PWM module counts upwards until it reaches the duty cycle value, and then continues to count upwards to the end of the frequency cycle as determined by the values in PTPERx registers, PDCxx must be lower than PTPERx.
Thanks again,
Andy
Bookmarks