Set up a timer and toggle the IR-pin with the appropriate frequency, 36kHz or whatever suits.
For maximum simplicity load the measured values in a delay-loop and switch the IR-pin from output to input, depending if there should be a signal or not.
Another way would be to connect and disconnect the IR-pin from the timer and use a second timer to control the period length of the 36kHz signal.
Connecting and disconnecting can be done by reconfiguring the timer or accessing the appropriate timer-register directly.
↧