i want to make a pulse train, needed for steering of a IR led.
i don't see how to do that on a easy way.
i use a atmega 16, running on a 8Mhz X-tal.
thanks in advance.
Is this for a Remote Control?
If so, try a search - it has been covered many times before.
no remote control,..
>i don't see how to do that on a easy way.
Start by creating the 26us pulse train. At 8Mhz, 208 clocks is 26us (will assume 26us is the cycle period). Use an 8bit timer in ctc mode with top at 103 (208/2-1), and have the waveform output toggle a pin on compare match, that should get the fast pulse train going. Not so hard. Now you simply have to enable/disable the output in 500ms intervals, which should be the easier part.
that is exactly what i'm trying now.
I use a timer to generate the 37 or 38 KHZ wave. See your datasheet for how to use pwm mode of the timer. I also use a timer to give me a time base, perhaps just an interrupt from the pwm timer.
Now, in my application loop, I see what time it is, perhaps something close to millisecond. AND this with 3 or something. If you get 0, turn the pwm output on in the timer control register. If you get 1, look to see if you're detecting the signal, then turn the pwm output off.
If you don't know my whole story, keep your mouth shut.
If you know my whole story, you're an accomplice. Keep your mouth shut.
© 2020 Microchip Technology Inc.