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
|
||||||
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.
#define SET_EDGE_CAPTURE CCP1CONbits.CCP1M0
|
||||||
RCA IR Remote protocol56 KHz carrier frequency
fosc 3.20E+07
16 bit total states 65536
So each count is one microsecond
|