IR Remote RCA Notes

by Dan Peirce B.Sc.


July 21, 2007
These note were taken during the development of a C function for detecting transmissions from an RCA remote.
The PIC18F4525 is the target system and the C18 compiler will be used.
The function will make use of the CCP1 compare module.
From PIC18F4525 Datasheet
PIR1 Eight bit register associated with interupt flags. The flag is set when event takes place. Must be reset to detect new event. Can be used with an actual interupt or can be polled.
  PIR1bits.CCP1IF = 0; This line clears the capture1 event flag.

#define CAPTURE1_EVENT_FLAG   PIR1bits.CCP1IF 
#define RESET  0

 PIR1bits.TMR1IF = 0; This line clears the timer1 event flag

#define TIMER1_EVENT_FLAG  PIR1bits.TMR1IF

CCP1CONbits.CCP1M0 Contains the bit the determins if capture is on the rising rising edge or falling edge.
 
falling edge 0
rising edge 1

#define SET_EDGE_CAPTURE  CCP1CONbits.CCP1M0
#define FALLING_EDGE  0
#define RISING_EDGE  1

RCA IR Remote protocol

based on http://www.sbprojects.com/knowledge/ir/rca.htm

56 KHz carrier frequency

frame pulse code (includes 4 bit address followed by 8 bit data) code inverted
4 ms of pulses | 4 ms no pulse 0.5 ms of pulses | 2 ms of no pulses for 1 | 1 ms of no pulses for a 0 0's sent in place of 1's and 
1"s sent in place of zeros.

fosc 3.20E+07
finst (fosc/4) 8.00E+06
Ftimer1 1.00E+06
T timer1 1.00E-06

16 bit total states 65536
max time 0.065536

So each count is one microsecond 
Count of 4 ms 4000
Count of 8 ms 8000
Count of 2.5 ms 2500
Count of 1.5 ms 1500