Generating guard interval in C

Hi, I am using the ATtiny45 and I need to generate two complementary signals for a transistor drive. I am programming it using the Mega2560 board and the code is in AVR embedded C. I'm wondering how to generate a guard interval between the pulses of the two signals in the fastest possible way. I could do it with a conditional construct and check which of them is high, complement it, insert guard delay and then invert the other. But isn't there a faster way?

I cannot use the CTC mode of timerx that auto-inserts a guard space between updating OCxA and ~(OCxA), because I have both timers working out other things for me. I have to do it with the I/O port registers and very fast.

Any ideas?

How are you deciding which pin should be high in the first place, if you're not using the timer to do it? Confused - the Timer1 deadtime generator is, quite literally, made for exactly this.

I'm using millis for that. One of the pin is initially made high and then the pair is complemented periodically. I can't use the inbuilt dead time generator because that timer will be independently generating a PWM.

wornoutflipflops: Hi, I am using the ATtiny45 and I need to generate two complementary signals for a transistor drive. I am programming it using the Mega2560 board and the code is in AVR embedded C. I'm wondering how to generate a guard interval between the pulses of the two signals in the fastest possible way. I could do it with a conditional construct and check which of them is high, complement it, insert guard delay and then invert the other. But isn't there a faster way?

I cannot use the CTC mode of timerx that auto-inserts a guard space between updating OCxA and ~(OCxA), because I have both timers working out other things for me. I have to do it with the I/O port registers and very fast.

Any ideas?

The Tiny 25/45/85 processors have two 8 bit timers. Are you using both?

Yes. One generates a separate PWM, while the other runs millis and delay.

So you have two outputs: A is on when HIGH B is on when LOW

And what you want is doing is:

Turn A off Wait for guard interval Turn B on (time passes) Turn B off Wait for guard interval Turn A on (repeat)

How long is the guard interval? Is this right?

How long is the time between switching which is on?

I assume you're using direct port writes?

Sorry if I wasn’t much clear in the beginning. I have attached the schematic of my connections.

DrAzzy:
Turn A off
Wait for guard interval
Turn B on
(time passes)
Turn B off
Wait for guard interval
Turn A on
(repeat)

Yes. A and B are PB3 and PB4 pins of ATtiny.

DrAzzy:
How long is the guard interval?
How long is the time between switching which is on?

T(ON) and T(OFF) both are around 5ms to 10ms (constant throughout).
And the guard interval depends on how much they are overlapping right?
I have to decide the interval after seeing the overlap on an oscilloscope.