IR transmission from uC
Monday night I got code running on the same microcontroller to successfully emit the modulated signal and trigger the LED as hooked up before. However, trying to strictly time the length of the pulses was really difficult because the receiving interrupt kept messing up the timing. I was using delay functions for simplicity in a main loop, rather than running an additional timer interrupt, which would have been the correct way to do it.
Because the first seminar is rapidly approaching and I’m sitting here with my hands in my pocket, I’ve decided that developing both a robust transmit and receive interrupt on the same chip is not really worth the time it would take, as they will be running on separate chips anyway. I tried to get started working on an ATtiny 85 beacon, however, I don’t think the fuses are set correctly to use the internal oscillator. The Olimex board I have does come with a 10MHz crystal, but it’s not hooked up. I’m going to read into the data card tonight and see if I can find anything about initial configurations. (I’d imagine that the internal osc would be the default, because the thing only has 8 pins, and the osc takes two, but that’s just how I would do it)
Code should be really simple. I’ll initialize a single timer to give me an interrupt every half period of the 38kHz signal (13 uS) In the interrupt handler, I’ll increment a counter variable, and toggle the LED output between 0 and a global ‘bit’ variable. In the main loop, I’ll keep watch on the global counter, and change the current sent ‘bit’ appropriately.
The planned protocol will be ~5mS pulse to enable all interrupts listening, followed by 500 uS wide bits. Total data sent will be a 16 bit ID followed by a single even parity bit.