完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
#include
#define uchar unsigned char #define Imax 14000 #define Imin 800 uchar x; uchar y; uchar z; uchar irtime; uchar flag; uchar i; uchar n; uchar numbit; uchar irreceok; uchar ircode[4]; uchar temp; uchar irprosok; uchar k; uchar w; uchar display[8]; uchar code dulasmg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar code welasmg[]={0x08,0x18,0x28,0x38,0x48,0x58,0x68,0x78}; 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 t0_init(){ ET0=1; EA=1; TMOD=0x02; TH0=0x00; TL0=0x00; TR0=1;} void ex_init(){ EX0=1; EA=1; IT0=1;} void time0() interrupt 1{ irtime++; } void ex() interrupt 0{ if(flag){ TR0=0; if(irtime>51) { numbit=0; } irdata[numbit]=irtime; irtime=0; numbit++; if(numbit==33) {numbit=0; irreceok=1;} } else { flag=1; irtime=0; } } void irpros(){ k=1; for(n=0;n<4;n++){ for(i=0;i<8;i++) { temp=temp>>1; if(irdata[k]>6) {temp=temp|0x80;} k++; } ircode[n]=temp; } irprosok=1; } void irwork(){ display[0]=ircode[0]/16; display[1]=ircode[0]%16; display[2]=ircode[1]/16; display[3]=ircode[1]%16; display[4]=ircode[2]/16; display[5]=ircode[2]%16; display[6]=ircode[3]/16; display[7]=ircode[3]%16; } void disp(){ for(w=0;w<8;w++){ P0=dulasmg[display[w]]; dula=1; dula=0; P0=welasmg[w]; wela=1; wela=0; delay(100); } } void main(void){ ex_init(); t0_init(); while(1){ if(irreceok) { irpros(); irreceok=0; if(irprosok) {irwork(); irprosok=0; disp(); } } } } |
|
相关推荐
2个回答
|
|
|
你可以把原理图发上来给你看一下。
|
|
|
|
|
|
看看!!!!!!!!!!!!!!!!
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
【瑞萨RA6E2】瑞萨E2S软件安装过程,等待过程玩下97_e2 studio_ZGZZ
331 浏览 0 评论
532 浏览 0 评论
【原创】【RA4M2-SENSOR开发板评测】低功耗+USB综合测试
842 浏览 0 评论
1383 浏览 2 评论
824 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
16920 浏览 31 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 21:07 , Processed in 0.840980 second(s), Total 77, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3315