I have been trying to implement dead time on the Arduino Due board using complementary PWM outputs in order to control H-bridge inverter. On the first view, my program code works, but not completely correct. Actually, two problem are appeared :
at the beginning and in the end of the output signals I get overlaps - dead time in this two points does not have reaction
if I adjust constant modulation signal instead of sin, every some time I can see bigger value of the dead time than adjusted value in the program code.
Does anybody know how I can solve this problem?
Maybe, I cannot see some detail which makes this problem.
float x = 0; // argument of the sine function
const float pi = 3.1415;
int i = 0;
int k = 0;
float carrierfreq = 4000; // Carrier frequency
float modfreq = 50; // Modulation frequency
float ris = carrierfreq / modfreq; // points where the sine function is divided
float Ton1 = 0; // ignition time, random initialization
int DeadTimeHigh = 500;
int DeadTimeLow = 500;
float lookup1[2500];
int clkfreq = 42000000;
float cprd = (clkfreq /(carrierfreq*2));
void lookuptable() {
for (i = 0; i <= ris; i++) {
lookup1 = sin(x);
_ x = x + 2 * pi / ris;_