Greetings,
I am trying, with an Arduino UNO, to generate two PWM signals of 50kHz, 25% of duty cycle and phase shifted at 90º degrees to control and Half-Bridge power converter. I tried to use the TimerOne library and I did successfully generate two PWM signals of 50kHz@25%duty. However, I was not successful in the 90 degrees phase shift. Both PWM generated signals had the same phase. Below are my code so far..
#include "TimerOne.h"
void setup()
{
pinMode(9, OUTPUT);
Timer1.initialize(20); // initialize timer1, and set at 50kHz
Timer1.pwm(9, 256); // setup pwm on pin 9, 25% duty cycle
Timer1.pwm(10, 256); // setup pwm on pin 9, 25% duty cycle
}
void loop()
{
// your program here...
}
How I can phase shift the second PWM signal in pin10 to look something like this in the screenshot below? I also tried to mess with the ATMega328 internal registers but nothing so far...
Best regards,
F.Borges