完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
#include
#include #define uchar unsigned char ***it IRIN=P3^2; uchar x; uchar y; uchar z; uchar irtime; uchar i; uchar n; uchar irreceok; uchar ircode[4]; uchar temp; uchar irprosok; uchar k; uchar w; uchar code dulasmg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void delay(z){ for(x=z;x>0;x--) for(y=110 ;y>0;y--); } ***it dula=P2^6; ***it wela=P2^7; uchar irdata[33]; void irpros(void); void irwork(void); void timer0init(void){ ET0=1; EA=1; TMOD=0x02; TH0=0x00; TL0=0x00; TR0=1;} void ex_init(void){ IT0=1; EX0=1; EA=1;} void timer0() interrupt 1 { irtime++; } void ex0_isr(void) interrupt 0{ static bit iflag; static uchar numbit; if(iflag){ if(irtime<58&&irtime>=30) numbit=0; irdata[numbit]=irtime; irtime=0; numbit++; if(numbit==33) {numbit=0; irreceok=1;} } else { irtime=0; iflag=1; } } void irpros(void){ k=1; for(n=0;n<4;n++){ for(i=i;i<=8;i++) { if(irdata[k]>7) {temp=temp|0x80;} if(i<8){ temp=temp>>1;} k++; } ircode[n]=temp; temp=0; } irprosok=1; } void irwork(void){ switch(ircode[2]) { case 0x0c:P0=dulasmg[1];break; case 0x18:P0=dulasmg[2];break; case 0x5e:P0=dulasmg[3];break; case 0x08:P0=dulasmg[4];break; case 0x1c:P0=dulasmg[5];break; case 0x5a:P0=dulasmg[6];break; case 0x42:P0=dulasmg[7];break; case 0x52:P0=dulasmg[8];break; default:break; } irprosok=0; } void main(void){ ex_init(); timer0init(); P0=0xfb; wela=1; wela=0; while(1){ if(irreceok) { irpros(); irreceok=0;} if(irprosok) { irwork(); } } } |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
【瑞萨RA6E2】瑞萨E2S软件安装过程,等待过程玩下97_e2 studio_ZGZZ
331 浏览 0 评论
532 浏览 0 评论
【原创】【RA4M2-SENSOR开发板评测】低功耗+USB综合测试
842 浏览 0 评论
1383 浏览 2 评论
824 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
16914 浏览 31 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 18:59 , Processed in 0.872653 second(s), Total 71, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
6293