📄 int.lst
字号:
KEY_IR_,// 0xF2,
KEY_IR_,// 0xFF,
KEY_IR_,// 0xF4,
KEY_IR_,// 0xF5,
KEY_IR_,// 0xF6,
KEY_IR_,// 0xF7,
KEY_IR_,// 0xF8,
KEY_IR_,// 0xF9,
C51 COMPILER V8.02 INT 10/16/2006 17:42:27 PAGE 11
KEY_IR_,// 0xFA,
KEY_IR_,// 0xFB,
KEY_IR_,// 0xFC,
KEY_IR_,// 0xFD,
KEY_IR_,// 0xFE,
KEY_IR_// 0xFF,
};
#define IR_KEY_REPEAT_MASK_TIMES 5
#define IR_INPUT_BUFFER_CLEAR 0x0000
BOOL Get_Key_Code_Part=0;
void T2EX_int (void) interrupt 5 using 2 /* Negative Transition on T2EX */
{
//process the interrupt reason
BOOL temp_bit;
// EX1=0;
/*1. When the timer2 overflow */
if(TF2)
{
IR_Get_Start_Begin=0;
//clear interrupt flag
TF2=0;
EXF2=0;
//reaset the Timer2
TR2=0; /*stop timer2*/
TH2=0; TL2=0; /*reload the prescalor 19.6ms for X=40M , 28.9mS for X=27M 37.5ms for X=22.118M*/
TR2=1;
IR_Bit_Counter=0;
Get_Single_Key_Code=0;
IR_Input_Bits_Buffer=0x0000;
Timer2_Overflow_Times_Counter++;
if(Get_Key_Code_Part)
{
Enable_Repeat_Bit=1;
}
if(Timer2_Overflow_Times_Counter&0x08) //8*28.9ms>=224ms //&0x10 //16*9.8ms>=150ms)
{
//when the time intervel is large than 108-58.5=49.5ms,disable the repeat key
Enable_Repeat_Bit=0;
Get_Key_Code_Part=0;
Timer2_Overflow_Times_Counter=0x08; //0x10;
}
return;
}
C51 COMPILER V8.02 INT 10/16/2006 17:42:27 PAGE 12
/* 2.the extern T2EX high-to-low triggle the interrupt*/
EXF2=0;
//reaset the Timer2
TR2=0; /*stop timer2*/
TH2=0; TL2=0; /*reload the prescalor 19.6ms for X=40M , 9.69ms for X=40.78X2 37.5ms for X=22.118M 25.9
-8ms for X=24.598X*/
TR2=1; /*start timer2*/
//check the bit width
IR_Bit_Width= RCAP2L+ ( (U16)(RCAP2H) <<8 );
//when the start bit interrupt,we will kill this interrupt
if(IR_Get_Start_Begin==0)
{
IR_Get_Start_Begin=1;
#if( SYSTEM_CRYSTAL ==USE_CRYSTAL_40M039_X2)
//only when the X>69.36M ,theis part is needed
if(Timer2_Overflow_Times_Counter==1)
{
if(Enable_Repeat_Bit==1)
{
if(IR_Bit_Width>NEC_IR_REPEAT_BIT_WIDTH_MIN&&IR_Bit_Width<NEC_IR_REPEAT_BIT_WIDTH_MAX)
{
RCAP2H=0;
RCAP2L=0;
if(IR_Key_Repeat_Counter>=IR_KEY_REPEAT_MASK_TIMES)
{
//look for the repeat enable table ,if repeat enable send the key ,else do nothing
if(IR_Key_Repeat_Enable_Table[IR_Key_Code]==1)
{
Key_Code=IR_Key_Code;
IR_Key_Repeat_Counter=IR_KEY_REPEAT_MASK_TIMES;
}
else
IR_Key_Repeat_Counter=0;
}
IR_Key_Repeat_Counter++;
}
}
}
#endif
Timer2_Overflow_Times_Counter=0;
return;
}
if(Enable_Repeat_Bit==1)
{
if(IR_Bit_Width>NEC_IR_REPEAT_BIT_WIDTH_MIN&&IR_Bit_Width<NEC_IR_REPEAT_BIT_WIDTH_MAX)
{
C51 COMPILER V8.02 INT 10/16/2006 17:42:27 PAGE 13
RCAP2H=0;
RCAP2L=0;
if(IR_Key_Repeat_Counter>=IR_KEY_REPEAT_MASK_TIMES)
{
//look for the repeat enable table ,if repeat enable send the key ,else do nothing
if(IR_Key_Repeat_Enable_Table[IR_Key_Code]==1)
{
Key_Code=IR_Key_Code;
IR_Key_Repeat_Counter=IR_KEY_REPEAT_MASK_TIMES;
}
else
IR_Key_Repeat_Counter=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -