I am using the ATmega48PA. My application uses a lot of interrupt vectors. I am also using the Timer1 OC1A pin to output a square wave to control an high constant current circuit that drives an IR LED. I have already read the specific ATMEL ApNote, but it used a 455KHz resonator. In my design I am using an 8MHz crystal.
In continuous of this Topic:
would you be able to tell me an automatic way to toggle the OC1A output?
Which is the right way to produce a 50% Square wave, at ~38KHz, but without Interrupt.
In PWM mode, the Timer must count 210 pulses (8MHz / 38KHz = ~210, without prescaller) and the OCR1A register must contain the value of 149 (or 150) in order to have a 50% Duty Cycle, but I need to use the OVF interrupt in order to reload the TCNT1 register with 255-210 = 45. That way I have an output jitter even if I se all other interrupts as nested interrupts.
Is there any other way (I don't know) to do this without any interrupt? This is becaue I have