RC5 Protocol decoder using PIC16F887 and mikroC

After I build NEC remote control decoder using PIC16F887 and mikroC compiler, now let’s see how to decode IR remote controls which use RC-5 communication protocol. NEC decoder project link is below:
NEC remote control decoder with PIC16F887 and mikroC compiler

Also I made the same project which I’m going to do but using CCS PIC C compiler, project link is below with some information about the RC5 protocol:
RC-5 Decoder with PIC16F887 microcontroller and CCS C compiler

Components Required:

  • PIC16F887 microcontroller
  • IR Receiver
  • 1602 LCD screen
  • 10K ohm variable resistor
  • 5V Power source
  • Protoboard
  • Jumper wires

The Circuit:
RC-5 decoder with PIC16F887 circuit diagram is shown below.

NEC remote control decoder circuit

In this example the PIC16F887 microcontroller runs with its internal oscillator and MCLR pin is configured as digital input (configured in the software).
The IR receiver has three pins: VCC, OUT and GND. The output is connected to pin RB0.
The 16×2 LCD screen is connected to RD port (RD0 ~ 5).

RC-5 decoder mikroC code:
Before writing the C code of the decoder, I drew a simple state machine of the RC5 protocol which helped me a lot in the code. The state machine is shown below.

RC-5 protocol state machine

Where:
SP : Short Pulse (About 889µs)
LP : Long Pulse (About 1778µs)
SS: Short Space (About 889µs)
LS : Long Space (About 1778µs)
The resolution of the code is good as we’re working with interrupts.
Rest of code description is below.

The video below shows a simple hardware circuit of the decoder:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.