附录一 程序代码
红外遥控编码程序
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
#define uintlong unsigned long
sbit p3_0=P3^0;
sbit p2_1=P2^1;
sbit p1_0=P1^0;
sbit p1_1=P1^1;
sbit p1_2=P1^2;
sbit p1_3=P1^3;
bit out;
uint keyvalue=0x00,flag_key=0,value1,value2,keycount=0,i,j,flag_set=0,
flag_press=0;
uchar code keycode[4]={0x7f,0xbf,0xdf,0xef};
uchar code
portvalue[12]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x00,
0x0b};
uchar code wy[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
//**********红外发送部分**********//
uchar user1=0x00,user2=0x00;
uint count=0,endcount=0;
uint irdata=0;
void deltime(void);
void key_scan(void);
void sendirdata(void);
评论1
最新资源