浴室柜厂家
免费服务热线

Free service

hotline

010-00000000
浴室柜厂家
热门搜索:
技术资讯
当前位置:首页 > 技术资讯

NEC制式红外线解码程序

发布时间:2020-06-30 16:04:01 阅读: 来源:浴室柜厂家

此程序在STC89C52上实验通过!晶振11.05926,占用资源,外部中断1,LCD1602,显示解码!串口通讯波特率4800KBS;提示,在中端中不可以用while(p3_2);否则,不能顺利跳出终端!#include AT89X52.H>#include LCD.h

本文引用地址: uchar unsigned char #define uint unsigned int

//void Delay(unsigned int i);void chuangkou(void);void unint0 (void);void senddata(unsigned char outdata);unsigned char yandata[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};unsigned char Iid[4]={0,0,0,0};void main(void){ LCD1602();Init_Lcd();unint0();chuangkou();P3_2=1; senddata('1'); while(1){ Display_LCD_Byte(0,0,'I'); Display_LCD_Byte(0,1,'D'); Display_LCD_Byte(0,2,':'); Display_LCD_Byte(0,5,'0'); Display_LCD_Byte(0,6,'X');

Display_LCD_Byte(0,7,yandata[ Iid[0] / 16] ); Display_LCD_Byte(0,8,yandata[ Iid[0] % 16] );

Display_LCD_Byte(1,0,'D'); Display_LCD_Byte(1,1,'A'); Display_LCD_Byte(1,2,'T'); Display_LCD_Byte(1,3,'A'); Display_LCD_Byte(1,4,':'); Display_LCD_Byte(1,5,'0'); Display_LCD_Byte(1,6,'X'); Display_LCD_Byte(1,7,yandata[ Iid[2] / 16] ); Display_LCD_Byte(1,8,yandata[ Iid[2] % 16] );

}}

/*void Delay(unsigned int i){while(-- i);}*/

void chuangkou(void){TMOD = 0X20;// JI SHU QI 1TH1=0XFA; //11.0592, 4800KPSTL1 =0XFA;TR1=1; //QI DONG SCON=0X50; //PCON=0X00; //BU JIA BEI}void unint0 (void){EA=1;EX0=1;IT0=1;}void senddata(unsigned char outdata){SBUF=outdata;while(!TI);TI=0; }void INT_0() interrupt 0 using 1{unsigned char id[4]={0,0,0,0};unsigned char cishu0,cishu1,cishu2;EX0=0;for(cishu0=0;cishu010;cishu0++){Delay(100);if(P3_2) goto exit;}if(!P3_2){Delay(534);}while(!P3_2);//等待高电平 gou qufor(cishu1=0;cishu1 4 ; cishu1 ++){for(cishu2=0;cishu2 8 ; cishu2 ++){while(!P3_2);//等待该gao电平开始延时,判断高低Delay(90);if(P3_2) { id[cishu1]|= 0x01 cishu2; Delay(100); //while(P3_2);在解码时千万不要有这样的口令 }/* else { id[cishu1]= 0xfe cishu2; }*/}}if(id[0]!=~id[1]) goto exit;if(id[0]!=0x02) goto exit;if(id[2]!=~id[3]) goto exit;senddata(id[0]);// senddata(id[1]);senddata(id[2]);//数据码// senddata(id[3]);//数据码饭吗for(cishu0=0;cishu0200;cishu0++){P2_0=~P2_0;Delay(50);}Iid[0]=id[0];Iid[2]=id[2]; exit:// while(!P3_2);EX0=1;}

伺服电机相关文章:伺服电机工作原理

烟台防静电工作服订制

德州工作服定做

济南定做职业装

相关阅读