User manual

www.sainsmart.com
Copyright © 2013 SainSmart All Rights Reserved
ir_code=0x00;// clear
adrL_code=0x00;// clear
adrH_code=0x00;// clear
// Analysis of the remote control code user code value
for(i = 0 ; i < 16; i++)
{
if(logic_value() == 1) // if 1
ir_code |= (1<<i);//Save key value
}
// Analytical remote control code commands in the code
for(i = 0 ; i < 8; i++)
{
if(logic_value() == 1) // if 1
adrL_code |= (1<<i);//save key value
}
// Analysis of the remote control code user code value
for(j = 0 ; j < 8; j++)
{
if(logic_value() == 1) //if 1
adrH_code |= (1<<j);//save key value
}
}
void remote_decode(void)// Decoding function
{
TCNT1=0X00;
while(digitalRead(IR_IN))// if high wait
{
if(TCNT1>=1563) // When high level lasted for more than 100 ms, shows that at the
moment no key press
{
ir_code=0x00ff;// user code value
adrL_code=0x00;// a byte value before Key code
adrH_code=0x00;// a byte value after Key code
return;
}
}
// If high level cant last for more than 100 ms
TCNT1=0X00;
while(!(digitalRead(IR_IN))); //if low wait
Pulse_Width=TCNT1;
TCNT1=0;
if(Pulse_Width>=140&&Pulse_Width<=141)// 9ms