Downloads of v 1.0.1


Last published

IR Remote Control - Philips RC5...


This demo showcases the PIC16F's ability to concurrently perform RC5 encoding and decoding while taking advantage of Microchip's eXtreme Low Power (XLP) sleep mode during idle time. The provided source code is written 100% in ANSI C and is completely interrupt-driven.

Demo: IR RC5 Transmitter & Receiver

Device: PIC16LF1509-I/P (PDIP Package)

IDE: MPLAB X v2.00

Compiler: XC8 v1.21

Hardware: PICKit 2 Low Pin Count Demo Board (part no. DM164120-1)

Optional: PIC16LF1509 Debug header (part no. AC244052)


This demo shows the ability to concurrently perform RC5 encoding and decoding while MCU is in sleep mode during idle time.

A PICKit Low Pin Count Demo Board was used with a PIC16LF1509-ICE Processor Extension Pack (a.k.a. Debug header part no. AC244052)

for debugging purposes.

To run the demo right out of the box, a normal PIC16LF1509-I/P PDIP device can be programmed to operate in stand-alone mode.

In addition to the IR Tx and Rx pins, one of the pins is used to simulate what the IR Rx demodulated signal would look like for the

IR Tx modulated data that's generated for the IR LED so that a simple loopback test can be performed

(i.e. simultaneous decode of the IR transmission).

The SW1 button provided on the Low Pin Count Demo Board is used as the user button input.

Hold the button down to see the RC5 packets get transmitted continuously. To see the RC5 decoded data stream via UART,

connect the TXD pin to an external serial port's RXD @ 115200 baud (may need an RS-232 level translator if using a Host PC).

Quick Demo Setup/Sequence:

(1) Install PIC16LF1509 device into socket of Low Pin Count Demo Board

(2) Connect a temporary jumper wire between RC4 & RA2 (use header J1 for convenience)

(3) Program the PIC for stand-alone mode using PICKit3, ICD3, REAL ICE, etc.

(4) After power is applied to the board, the DS1 LED should come on

(5) While pressing down on SW1, the three DS1/DS2/DS3 LED's should each flash at different rates

(6) After letting go of SW1, the DS4 LED should come on (signifying that a valid RC5 packet was last received & decoded successfully)

Pin Assignment:

(3) CLKOUT [OUTPUT] - (Fosc / 4) whenever device is active/awake

(4) RA3 [INPUT] - User Button (active low - i.e. pull to ground to activate)

(5) PWM1 [OUTPUT] - IR Tx Modulated to LED

(6) RC4 [OUTPUT] - IR Rx Demodulated (outputs a simulated Rx signal for loopback testing)



(13) RC3 [OUTPUT] - Cleared in RC5 Decoder ISR; Set whenever valid RC5 data has been received

(14) RC2 [OUTPUT] - TMR2 ISR Toggle

(15) RC1 [OUTPUT] - TMR1 ISR Toggle

(16) RC0 [OUTPUT] - RC5 Decoder ISR Toggle

(17) RA2 [INPUT] - IR Rx from sensor (weak pull-up enabled)

Resources Used:

* RC5 Encoder - PWM1, TMR1, TMR2

* RC5 Decoder - TMR0


(1) SLEEP mode is used; button presses and IR Rx activity will serve as wakeup events

(2) To verify concurrent Tx and Rx functions, connect RC4 to RA2 to perform a simple loopback test

(3) Repeated packet function is supported - if user button is held down, repeated packets will be sent out every 114 msec

(4) On every SW1 button press, the address and command data fields are both incremented by one, and the toggle bit should switch between 0 & 1

(5) PIC16LF1509 Debug header (part no. AC244052) is required to use the SW1 pushbutton while in Debugger mode

(6) If using the AC244052 Debug header, it needs to be selected in the project's "Properties" Configuration page

To install IR Remote Control - Philips RC5 Protocol Encoder & Decoder, download this package and open it in IDE.

Supported Products: MPLAB X

Release Notes

Added support for UART to send out decoded RC5 data stream



Microchip Technology



    • No dependencies.

Version History

Version Downloads Last updated Approved