Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 4 months ago.
Double edge PWM library?
Hello! (I have not studied programming so some of the answers may be over my head but do not worry, i'll do my best to understand and study.)
i am having trouble as i am building a battery charger (20kW). it is done by controlling two pairs of IGBT-s through MOSFET-s.
i designed a lot of hardware(Power converters and electronic circuits) but now i am stomped on unforseen hardware/software problem. . Basically i need 4 PWM signals which pulse withs and starting points can be calculated and controlled. The signals control MOSFETS, which control the drivingcircuits of IGBT-s.
I am starting to realize that 1 PWM can be single edged(PWMOut can do that job.), but the 3 would have to be double edged PWM-s.
Found that by software i can emulate PWM but i have to modify it a litte bit. So basycally i need only 2 maybe 3 double edge PWM signals.
Is it possible to dot hat?
Could you give me some directions? (Started to read LPC1768 manual already) Any links to useful library writing instructions/tips/walktroughs will be appriciated. Meanwhile i'll read the manual.
f=5000Hz
2 Answers
12 years, 4 months ago.
The LPC1768 can generate 3 double edge PWM signals, then it can't generate more though (at least by the hardware PWM unit, I guess other timers can also be used to create PWM signals, and of course you got pure software PWM, which can work probably quite well with Ticker/TimeOut functions).
Regarding the double edged hardware PWM, you got of course the user manual. The mbed pwm source can't hurt: http://mbed.org/users/mbed_official/code/mbed-src/file/f9e72c209510/vendor/NXP/LPC1768/hal/pwmout_api.c. Together with the registers: http://mbed.org/users/mbed_official/code/mbed-src/file/f9e72c209510/vendor/NXP/LPC1768/cmsis/LPC17xx.h.
Basic library tips are given here: http://mbed.org/cookbook/Writing-a-Library.
I think if I would write such a library, I would either make the library a child of the official PWM class (as relative simple example, I did that here with SPI: http://mbed.org/users/Sissors/code/BurstSPI/), or as other option just make it a stand-alone library, and instantiate a PWM object to the pin. With both options you don't have to worry about setting the pin correct, frequency is already set correct, etc. So then you only need to put it on double edged mode, and set the correct timing for rising/falling edges.