I am trying to generate two 100KHz square waves to drive a full-bridge inverter using an Arduino Uno, with the following code:
TCCR1A = bit(COM1A0) // toggle OC1A on Compare Match
| bit (COM1B0); // toggle OC1A on Compare Match
TCCR1B = bit(WGM12)
| bit(CS11); // CTC, /8 prescaling
OCR1A = 9; // (9 + 1) * 8 CPU cycles -> 16 MHz / 80 = 100 KHz
}
This works well, and both OC1A and OC1B (9 and 10) display a 100KHz square waveform on my oscilloscope. However, I need to invert one of the signals. Is there any way to set the initial value of one of the pins to be inverted? The datasheet is making me think that 0 is always the starting value, based on this table:
Wow, thank you for the great replies! Also finding out about the web timers app which looks awesome for testing. Originally I was trying to the simpler mode rather than the fast PWM mode, is the fast PWM mode the only way to achieve what I want here? If so, why is that? I'm not looking for any duty cycle control for just a simple square wave (just a constant toggle which would give me the default 50%), which was why I assumed I shouldn't even use the PWM mode.