单片机 红外遥控 计数器
回帖(1)
2022-2-23 14:03:52
#include
static bit OP; //红外发射管的亮灭
static unsigned int count; //延时计数器
static unsigned int endcount; //终止延时计数
static unsigned char Flag; //红外发送标志
char iraddr1; //十六位地址的第一个字节
char iraddr2; //十六位地址的第二个字节
void SendIRdata(char p_irdata);
void delay();
char getkey()
{
P1=0xfe;P3_6=P3_7=1;P3_3=1;
if(!P1_4)return 1; //ON
if(!P1_5)return 2; //7
if(!P1_6)return 3; //8
if(!P1_7)return 4; //9
if(!P3_6)return 5; //X
if(!P3_7)return 6; //÷
P1=0xfd;
if(!P1_4)return 11; //+-
if(!P1_5)return 12; //4
if(!P1_6)return 13; //5
if(!P1_7)return 14; //6
if(!P3_6)return 15; //-
if(!P3_7)return 16; //MRC
P1=0xfb;
if(!P1_4)return 21; //%
if(!P1_5)return 22; //1
if(!P1_6)return 23; //2
if(!P1_7)return 24; //3
if(!P3_6)return 25; //+
if(!P3_7)return 26; //M-
P1=0xf7;
if(!P1_4)return 31; //□
if(!P1_5)return 32; //0
if(!P1_6
#include
static bit OP; //红外发射管的亮灭
static unsigned int count; //延时计数器
static unsigned int endcount; //终止延时计数
static unsigned char Flag; //红外发送标志
char iraddr1; //十六位地址的第一个字节
char iraddr2; //十六位地址的第二个字节
void SendIRdata(char p_irdata);
void delay();
char getkey()
{
P1=0xfe;P3_6=P3_7=1;P3_3=1;
if(!P1_4)return 1; //ON
if(!P1_5)return 2; //7
if(!P1_6)return 3; //8
if(!P1_7)return 4; //9
if(!P3_6)return 5; //X
if(!P3_7)return 6; //÷
P1=0xfd;
if(!P1_4)return 11; //+-
if(!P1_5)return 12; //4
if(!P1_6)return 13; //5
if(!P1_7)return 14; //6
if(!P3_6)return 15; //-
if(!P3_7)return 16; //MRC
P1=0xfb;
if(!P1_4)return 21; //%
if(!P1_5)return 22; //1
if(!P1_6)return 23; //2
if(!P1_7)return 24; //3
if(!P3_6)return 25; //+
if(!P3_7)return 26; //M-
P1=0xf7;
if(!P1_4)return 31; //□
if(!P1_5)return 32; //0
if(!P1_6
举报
更多回帖