View previous topic :: View next topic |
Author |
Message |
Mesut Yigit Guest
|
Dual channel software PWM at 10khz |
Posted: Mon Jan 24, 2005 3:14 pm |
|
|
HI all,
For my last project , I need to implement a software PWM that works at 10 khz (minimum 5Khz may be) , the duty cycles of PWM s has to be changed %0 to %99 independently. I will use each of the PWM signals to activate / deactivate 6 output ports of PIC C and D , each connected a 3 phase IGBT blocks to drive 2 different BLDC motors.
When I use TIMER 0 with DIVIDE BY 1 mode at 20 MHz , I should get around 10 Khz, yet the simulator PROTEUS VSM shows 500 Hz only.
Could any body help me to fix the problem , did somebody worked on a similar thing?
Thanks |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Jan 24, 2005 8:06 pm |
|
|
20MHz / 4 = 5MHz
5MHz / 256 = 19.5KHz
So timer0 will interrupt at a rate of 19.5KHz. Now if you are planning on a counter inside of timer0 interrupt and have 100 levels that will bring the frequency to about 195Hz. Maybe you are planning on just setting the timer value?? That probably isn't going to do it for you either.
What PIC are you using? |
|
|
Mesut YIGIT Guest
|
Soft PWM |
Posted: Tue Jan 25, 2005 3:09 am |
|
|
I am using 16F877 at 20 mhz. |
|
|
bluetooth
Joined: 08 Jan 2005 Posts: 74
|
|
Posted: Tue Jan 25, 2005 6:19 am |
|
|
You need to use the right chip for this requirement.
Look at the 18F2331, for example. It has an enhanced power control module (with the necessary 6 outputs) and support for commutation, whether you do this with position sensors or with the a/d. I don't see how you're going to be able to keep up with the commutation requirements with just an '877 (or any other regular PIC), especially with software PWM generation, and all this for TWO motors. The 2331 also has hardware fault support (great for preserving those expensive IGBT blocks), and has a quadrature encoder module.
I suggest you look at Microchip's AN885 and AN899 - they'll give you a lot of insight into these requirements.
Why not use two 18F2331's? A lot less work and much higher chance of success!
-- edited to fix AN889 -> AN899 |
|
|
|