volatile uint8_t plus_nums = 0;//记录下降沿数量
volatile uint8_t nec_code[4] = {0};//保存NEC协议数据
volatile uint8_t received_flag = 0;//接收完成标志
//#define debug
#ifdef DEBUG
sbit LED0 = P1^0;
sbit LED1 = P1^1;
sbit LED2 = P1^2;
sbit LED3 = P1^3;
sbit LED4 = P1^4;
sbit LED5 = P1^5;
sbit LED6 = P1^6;
sbit LED7 = P1^7;
sbit TEST = P2^0;
#endif
/**
*功能:初始化外部中断0、定时中断0、定时器1
*说明:定时器0不使能中断
**/
void Init_all_interrupt(void)
{
TMOD = 0x01;//16位计数值
ET0 = 1;
EX0 = 1;
IT0 = 1;
TR0 = 0;
EA = 1;
P1 = 0xff;
}
/**
*功能:解码NEC红外编码,外部中断0.
*共34个下降沿
!!!!