5 years, 10 months ago.

mbed complementary pwm single output

how can i design a complementary pwm output of 0.5 duty cyle with mbed mbed lpc1786?

1 Answer

5 years, 10 months ago.

Hi Aman,

Here is an example from the Mbed Drivers Reference Manual, link here https://os.mbed.com/docs/v5.9/reference/pwmout.html

PWMOut

#include "mbed.h"

PwmOut led(LED2);

int main() {
    // specify period first, then everything else
    led.period(4.0f);  // 4 second period
    led.write(0.50f);  // 50% duty cycle
    while(1);          // led flashing
}

As for the complementary pwm output, I don't understand what you mean by that. PWM is technique for controlling analog circuits with a microprocessor's digital outputs, which you can learn it herehttps://www.embedded.com/electronics-blogs/beginner-s-corner/4023833/Introduction-to-Pulse-Width-Modulation. So it does not matter if you are inverting it or not because the outcome result will still be the same. That being said, the Mbed API does not support complementing PWM signal. To do that, the easiest way is to run the pwm output through an external hardware inverter.

Please let me know if you have any questions!

- Peter, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!