How to generate complementary pwm pulses for bidirectional DC-DC converter.

Hello!
I had been working on half bridge bidirectional DC DC converter for quit long. Here I want to operate the converter in both synchronous buck and boost mode separately.
•For that I want to generate complementary pwm pulses for p and n channel MOSFETs.
•I also want to vary the pwm pluses externally with potentiometer.

I have tried working with analogRead() and analogWrite() for creating the desired pulses for my converter, but it didn't worked in synch. boost mode. I didn't found it much accurate.

So, now I want to use the internal Timer/Counter for generating the complementary pwm pulses with a dead time of 125ns at pin 3 and 11 of Arduino Uno.

I had also gone through the Atmega328P datasheet...but frankly speaking I ended up with my head spinning off. So pls, if anybody can help me out. I will be glad to seek your help.

Thank you in advance.

"It didn't work" is not very helpful. What was the behaviour, and how does it differ from what you expect?

aarg:
"It didn't work" is not very helpful. What was the behaviour, and how does it differ from what you expect?

Thank you aarg for your invaluable response.

To be specific I didn't found my piece of codes much accurate and so was the behaviour when I executed the code on the hardware. And also it was not to possible achieve a deadtime between the two complementary pulses.

What I expect, I'll again repeat, is a pair of complementary pulses with a dead time of 125ns between them. I hope I have cleared your doubt.