Saturday, 1 June 2013

How to determine infrared protocol using PIC16?

How to determine infrared protocol using PIC16?

I am trying to determine the IR protocol used in a Gree room air conditioner remote control. I connected the output of the original IR receiver to pin RA5 of a PIC16F73 and used the following code to measure the time periods of the high and low pulses.

while(1)
{
    while(PORTAbits.RA5 == 1) //Wait for a low edge.
    {
        ;
    }
    T1CONbits.TMR1ON = 0; //Turn off Timer 1.
    duration[durationCounter] = TMR1; //Record duration of pulse in array 'duration'.
    TMR1 = 0; //Reset Timer 1.
    durationCounter++;
    T1CONbits.TMR1ON = 1;
    lowEdges++;
    while(PORTAbits.RA5 == 0) //Wait for next high edge.
    {
        ;
    }
    T1CONbits.TMR1ON = 0; //Similarly for low edge.
    duration[durationCounter] = TMR1;
    TMR1 = 0;
    durationCounter++;
    T1CONbits.TMR1ON = 1;
    highEdges++;
}
I've entered the data in this excel file. But the pulse widths seem to vary randomly and make no sense to me :-(. I've checked articles on the NEC, RC-5 etc. protocols but none seems to match this data. Is the program inadequate to capture the data? Any insight would be very helpful. Thanks!

No comments:

Post a Comment