adding deadtime between output states

Hello guys i have quetion about how to add some deadtime between output states HIGH and LOW without using delay or millis on mega2560.i cant use phase correct mode.Do you have any ideas? thx

Do you have any ideas?

Can't use delay(), OK, don't want to use that anyway. Can't use millis() (or micros(), I presume), well that eliminates the main tools for doing timing so you make it real hard. I don't know how else to do it other than, maybe, set up a timer interrupt. I don't see how PWM fits in here.

Maybe describe in more detail what you want to do and someone may be able to help. And why you can't use millis() (or micros()).

ok... i want some dead time between 2 states to protect transistors from cross conductance.i used fast pwm to make 3 phase output signal.i didnt do that with phase correct because i dont know how to shift phases against each other. so in fast pwm it goes without deadtime.i think delay function can affect counting or not?maybe something like "debounce button" action?

Hello guys i have quetion about how to add some deadtime between output states HIGH and LOW without using delay or millis on mega2560.i cant use phase correct mode.Do you have any ideas? thx

This is not very clear. Can you please provide a sketch of the waveform you desire.

What is the limitation on pwm mode? Why?

byte deadTime = 0;
while(deadTime < 65) deadTime++;

This is basically a delay (or blocking code) but not specifically timer based. This will kill time as the MCU spends cycles to increment the variable. How much time will be trial and error and adjust as necessary… I should point out that I would NOT recommend doing things this way, but you’ve taken millis() and micros() off the table…

but you've taken millis() and micros() off the table...

And we still don't know why.

ok we can try it with millis/micros what we can get

This will kill time as the MCU spends cycles to increment the variable.

No, it won't. The compiler will see that the code accomplishes nothing, and optimize it away.

If the variable being incremented were volatile, then that statement would be true.