2617 views|2 replies

1

Posts

0

Resources
The OP
 

Problems with long pressing of infrared remote control [Copy link]

I am using ATMEGA8a. There is no problem with single key press. But I have been working on the continuous code for several days but still can't figure out how to identify the continuous code. Could you please tell me how to identify the continuous code?
  • uchar IR_buf[4]={0x00,0x00,0x00,0x00}; //IR_buf[0], IR_buf[1] are the user code low and user code high receiving buffers
  • // IR_buf[2], IR_buf[3] are the key data code and key data code inverse receiving buffers
  • /********us delay program, delay time 0.14ms(140us*)*******/
  • void Delayus(uint x)
  • {
  • char i, j;
  • for(i=0;i="" {for(j="0;j<210;j++);}"
  • }=""
  • interrupt="" [ext_int0]="" void="" ext_int0_isr(void)=""
  • {="" uchar="" i,j,sum="0;" gicr="" |="(0<= 30) //If the high level time is too long, exit the processing program
  • {
  • GICR |=(1<="" ir_buf="IR_buf" return;="" }="">> 1; //Accept one bit of data
  • if(sum >= 6)
  • {IR_buf = IR_buf | 0x80;} //If the count value is greater than 6 (high level time is greater than 0.56), it is data 1
  • sum = 0; //If the count value is less than 6, the highest bit of the data is filled with "0", indicating that "0" is received, and the timing is cleared at the same time
  • }
  • }
  • if(IR_buf[2]!=~IR_buf[3]) //Invert the key data code and compare it with the key data code. If they are not equal, it means that the received data is wrong and give up
  • { GICR |=(1<=""
  • void=""
  • {=""
  • }="" else="" hw_status="1;" if(="" if((ir_buf[2]="=0xfb)||(IR_buf[2]==e))" if(hw_status="=1)" m;="" return;}="" rr()="" static="" uchar="" volume_1="" volume_1;}="" volume_1<98)="" {="" {++="" 遥控器键控="" 音量加="">=98)
  • { VOLUME_1=98;}
  • }
  • if((IR_buf[2]==0xfa)||(IR_buf[2]==b)) //Volume reduction
  • {
  • if( VOLUME_1>0)
  • {-- VOLUME_1;}
  • }
  • void RR() //Remote control key processing
  • {
  • if(HW_Status==1)
  • { static uchar m;
  • if((IR_buf[2]==0xfb)||(IR_buf[2]==e)) //Volume increase
  • {
  • if( VOLUME_1<98)
  • {++ VOLUME_1;}
  • else if( VOLUME_1>=98)
  • { VOLUME_1=98;}
  • }
  • if((IR_buf[2]==0xfa)||(IR_buf[2]==b)) //Volume decrease
  • {
  • if( VOLUME_1>0)
  • {-- VOLUME_1;}
  • }
  • }


This post is from Microchip MCU

Latest reply

Understand Understand  Details Published on 2019-4-1 12:56
 

4005

Posts

0

Resources
2
 
The burst mode depends on the remote control. Some remote controls can also fire bursts with a single press.
This post is from Microchip MCU
 
 
 

71

Posts

0

Resources
3
 
Understand Understand
This post is from Microchip MCU
 
Personal signatureFTP
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list