07.12.2012 Views

DRM081, Multi-Button IR Remote Control using the MC9RS08KA2 ...

DRM081, Multi-Button IR Remote Control using the MC9RS08KA2 ...

DRM081, Multi-Button IR Remote Control using the MC9RS08KA2 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.3.2 Key Decoding<br />

<strong>Multi</strong>-<strong>Button</strong> <strong>IR</strong> <strong>Remote</strong> <strong>Control</strong> <strong>using</strong> <strong>the</strong> <strong>MC9RS08KA2</strong>, Rev. 0<br />

Transmitter Software Implementation<br />

The flow chart in Figure 5-1 shows that when a button is pressed, <strong>the</strong> system will wake up from stop mode.<br />

After that, key decoding is performed. The detail operation of <strong>the</strong> key decoding is shown in <strong>the</strong> flow chart<br />

of Figure 5-2. When <strong>the</strong> system wakes up, <strong>the</strong> keyboard interrupt will be disabled and key debounce<br />

performed to eliminate <strong>the</strong> noise that may trigger a wrong key pressed. After key debounce, key decoding<br />

is performed to determine which button is pressed. This reference design uses an emulated ADC to find<br />

out which key is pressed. When a key is pressed, both comparator pins (ACMP+ and ACMP–) and <strong>the</strong><br />

timer will be enabled and timer count starts. The voltage on <strong>the</strong> ACMP– pin is dependent on <strong>the</strong> resistor<br />

divider that is connected to <strong>the</strong> keys on <strong>the</strong> keypad. The timer counts <strong>the</strong> period for <strong>the</strong> voltage on <strong>the</strong><br />

ACMP+ pin to charge up until it is equal to <strong>the</strong> voltage on <strong>the</strong> ACMP– pin. When <strong>the</strong> two voltages are<br />

equal, an interrupt will occur and <strong>the</strong> timer count is recorded. As each button has a different voltage and<br />

hence, different timer counts, <strong>the</strong> button pressed can be determined.<br />

When <strong>the</strong> key is identified, <strong>the</strong> control frame will be updated according <strong>the</strong> function of <strong>the</strong> key. The frame<br />

is <strong>the</strong>n transmitted out through <strong>the</strong> <strong>IR</strong> transmitter diode with 38kHz, 1/3 duty, cycle carrier.<br />

5.3.3 Transmission <strong>Control</strong> Frame Update<br />

When <strong>the</strong> key is identified, <strong>the</strong> transmission control frame is updated based on <strong>the</strong> assigned function of<br />

<strong>the</strong> key. The definition of <strong>the</strong> transmission control frame is shown in Table 3-1 and <strong>the</strong> definition of <strong>the</strong><br />

key function are described in 4.2.2 Keypad Scanning.<br />

Freescale Semiconductor 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!