Now I can recognize different buttons refer to AtomSoft's program.
https://www.electro-tech-online.com/threads/sony-infared-code-in-c18.93570/
But...the signal is unstable.,or is there any wrong in my program??
--------------------------
void GetPulse(void)
{
char x;
unsigned char count=0;
unsigned char lTime=0;
StartLook:
while(irPin); //wait for it to be low
lTime = 0; //reset the counter
while(irPin == 0){ //while the pin is low which is our pulse count
lTime++; //increment every 200uS until pin is high
Delay100TCYx(16); //200uS delay
}
if(lTime <= 4) //Start too short
goto StartLook; //Restart
if(lTime >= 6) //Start too long
goto StartLook; //Restart
putrsXLCD("SENSE");
lTime = 0;
for(x=0;x<13;x++){ //repeat 13 times for command
while(irPin); //wait for it to be low
lTime = 0; //reset the counter
while(irPin == 0){ //while the pin is low which is our pulse count
lTime++; //increment every 100uS until pin is high
Delay100TCYx(8); //100uS delay
}
if(lTime >= 6) {
count++;
}
}
--------------------------------------------
I wanna use 'count' to recognizethe data.However, the numbers of count are unstable that will change. How can I fix it??