文档之家
首页
教学研究
幼儿教育
高等教育
外语考试
建筑/土木
经管营销
自然科学
当前位置:
文档之家
›
基于51单片机的红外遥控编码解码电路
基于51单片机的红外遥控编码解码电路
格式:pdf
大小:266.19 KB
文档页数:6
下载文档原格式
下载原文件
/ 6
下载本文档
下载提示
文本预览
1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
while(1) { while(remotein==1) { _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); remdata++; } if(remdata>m) //高电平>5毫秒退出 {remotedata[n]=0x00;EX0=1;EA=1;goto end;} remotedata[n]=remdata;n++; remdata=0x0000; while(remotein==0) { _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_Biblioteka Baiduop_();_nop_();_nop_();_nop_(); remdata++; } remotedata[n]=remdata; n++; remdata=0x00; } end: lamp=0;studylamp=0; } 电路:
实物:
2009-06-25 12:39
TMOD=0x22; PCON=0X00; TH1=0xf3; TL1=0xf3; IT0=1; EX0=1; EA=1; } //键功能函数 void key_tx() { if(txkey==0) { delay1ms(1); if(txkey==0) { while(txkey==0); ET1=1;TR1=1; for(i=head;i>0;i--); remoteout=0;ET1=0;TR1=0; n=0; while(1) { lamp=0; studylamp=1; if(remotedata[n]==0x00) { delay1ms(10);break; } for(i=remotedata[n];i>0;i--) { _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_(); } n++; ET1=1;TR1=1; for(i=remotedata[n];i>0;i--);
当学习键按下后,红外接收头便可将接受到的信号存储到单片机中。在接受到通用 发出的信号后,如果按下发射键,单片机将调出刚刚储存的信息,通过红外发射头 和遥控器一样的信号来达到控制的作用。 #include <reg52.h> #include <intrins.h> #define uchar unsigned char #define uint unsigned int sbit studylamp=P2^7; sbit lamp=P2^6; sbit studykey=P3^2; sbit remotein=P1^1; sbit remoteout=P1^0; sbit txkey=P2^0; uint i,j,m=255,n,k,s; uchar idata remotedata[206]; uint head; uint remdata; //一毫秒延时程序 delay1ms(uint t) { for(i=0;i<t;i++) for(i=0;j<120;j++); } //初始化函数 clearmen() { studylamp=1; lamp=1; remoteout=0; remotein=1; for(i=0;i<206;i++) { remotedata[i]=0x00; } IE=0x00; IP=0x01;
remoteout=0;ET1=0;TR1=0;n++; } } } } //主函数 void main() { clearmen(); //初始化 while(1) { key_tx(); //按键扫描 } } //40KHz发生器 void time_intt1(void) interrupt 3 { remoteout=~remoteout; } //外中断0 void intt0(void) interrupt 0 { ET1=0;TR1=0;EX0=0;EA=0; head=0; while(studykey==0); studylamp=0;lamp=1; while(remotein==1); head=0; while(remotein==0) { _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); head++; } n=0;remdata=0x0000;
相关主题
51单片机红外遥控解码
51单片机电路的设计
51单片机红外遥控小车
51单片机红外解码程序
51单片机红外遥控
文档推荐
简单51单片机开发板的电路设计
页数:15
STC89C51单片机学习电路板设计
页数:2
用51单片机设计时钟电路
页数:6
51单片机AD89电路设计程序+原理图
页数:9
51单片机AD0809电路设计程序+原理图
页数:9
C51单片机常用接口电路设计
页数:90
基于51单片机的液晶显示器控制电路设计_本科论文
页数:37
基于51单片机开发板原理图设计
页数:1
电子时钟基于AT89c51单片机设计电路图及程序
页数:7
简单51单片机开发板的电路设计
页数:17
最新文档
饭店包间名字大全
word无法创建工作文件,请检查临时环境变量
自行车健身比赛开幕式讲话词
2018乡村医生个人工作总结
MySQL测试题 SQL
合勤NXC5200
铁路集中箱空箱调度优化建模案例(案例2)
微分几何教学大纲-复旦大学数学科学学院
人教版九年级数学上册导学案:24.1.1_圆【精品】
(整容后办护照用)医院整容证明