I cannot identify signals from the RC5 remote with PIC18f4520 to control a cd-player. For cd-player, different data of buttons should be recognized. Below are some of my c program code.
----------------------------------------------------
void GetPulse(void)
{
int counter=0;
Delay100TCYx(143); // to delay ~1.778ms,using 32MHZ
while(PORTBbits.RB3==1);
putrsXLCD("SENSE"); //prove that it sense the falling edge
while(counter<14) //14bits of RC5
{
if(PORTBbits.RB3==0)
counter++;
Delay100TCYx(143);
}
if (counter>8)
putrsXLCD("SENSE for 9 zero");
}
--------------------------------------------
I get a problem that when a signal is sent from the remote, the counter will add to 14 everytime. Is there any wrongs in my program.
----------------------------------------------------
void GetPulse(void)
{
int counter=0;
Delay100TCYx(143); // to delay ~1.778ms,using 32MHZ
while(PORTBbits.RB3==1);
putrsXLCD("SENSE"); //prove that it sense the falling edge
while(counter<14) //14bits of RC5
{
if(PORTBbits.RB3==0)
counter++;
Delay100TCYx(143);
}
if (counter>8)
putrsXLCD("SENSE for 9 zero");
}
--------------------------------------------
I get a problem that when a signal is sent from the remote, the counter will add to 14 everytime. Is there any wrongs in my program.