为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

有毒气体报警器

2017-09-19 6页 doc 55KB 23阅读

用户头像

is_215732

暂无简介

举报
有毒气体报警器【作品名称】:有毒气体气报警器 【功能介绍】:周围有毒气体浓度增加时,数码管显示的数值也相应增加,数码管显示的数值表示周围有毒气体的浓度,当周围的有毒气体的浓度增加到一定时,蜂鸣器发出声音进行报警。按下K1,进入设定报警值,初始值为0.200,按下K2减少数值,按下K3增加数值,设定完成后按下K1退出设定。 【主要应用】:家庭煤气泄漏报警、环境有毒气体检测。 电路: 程序: #include #define  uint unsigned int #define uchar unsigned char sbit key1=P2...
有毒气体报警器
【作品名称】:有毒气体气报警器 【功能介绍】:周围有毒气体浓度增加时,数码管显示的数值也相应增加,数码管显示的数值表示周围有毒气体的浓度,当周围的有毒气体的浓度增加到一定时,蜂鸣器发出声音进行报警。按下K1,进入设定报警值,初始值为0.200,按下K2减少数值,按下K3增加数值,设定完成后按下K1退出设定。 【主要应用】:家庭煤气泄漏报警、环境有毒气体检测。 电路: 程序: #include #define  uint unsigned int #define uchar unsigned char sbit key1=P2^0; sbit key2=P2^1; sbit key3=P2^2; sbit led1=P1^0; sbit led2=P1^1; sbit led3=P1^2; sbit ds1=P2^4; sbit ds2=P2^5; sbit ds3=P2^6; sbit ds4=P2^7; sbit beep=P2^3; uint f=0; uchar i=0; uchar status_flag; uint k=0; uint l=0; uint temp=20; void xianshi1(); void xianshi2(); void fengming(); uchar code SEG7[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void delay(int k) {uint i,j; for(i=0;i1) status_flag=0; while(!key3);} }    } void initime() {   TMOD=0x51;  //T1计数器,T0定时器,方式1   TL0=(65536-10000)%256;   TH0=(65536-10000)/256;   TL1=0;   TH1=0;   ET0=1;   EA=1; } void xianshi1() { P0=SEG7[k%10];                ds1=0;     ds2=1;     ds3=1;     ds4=1;                        delay(1);                        P0= SEG7[k/100];     ds1=1;     ds2=0;     ds3=1;     ds4=1;                            delay(1);                        P0= SEG7[(k%100)/10];     ds1=1;     ds2=1;     ds3=0;     ds4=1;                            delay(1);                        P0=0xbf;            ds1=1;     ds2=1;     ds3=1;     ds4=0;                            delay(1);                    } void xianshi2() { P0=SEG7[0] ;                ds1=0;     ds2=1;     ds3=1;     ds4=1;                        delay(1);                        P0= SEG7[temp/10];     ds1=1;     ds2=0;     ds3=1;     ds4=1;                            delay(1);                        P0= SEG7[temp%10];     ds1=1;     ds2=1;     ds3=0;     ds4=1;                            delay(1);                        P0=0xbf;            ds1=1;     ds2=1;     ds3=1;     ds4=0;                            delay(1);                    }                void main() {P1=0x00; initime();   TR0=1;   TR1=1; while(1) { anjian3(); switch(status_flag) {case 0:xianshi1();led1=1;led2=0;led3=0;if(f>temp*10){led1=0;fengming();}break; case 1:xianshi2();anjian1();anjian2();led3=1;led1=0;led2=0;break; default: break; } } } timer()interrupt 1 using 2 { i=i+1; if(i==10) { i=0; f=TH1*256+TL1; k=f; TL1=0; TH1=0; if(k>=950){k=950;} }   TL0=(65536-10000)%256;   TH0=(65536-10000)/256; switch(status_flag) {case 0:xianshi1();break; case 1:xianshi2();break; default: break; } }
/
本文档为【有毒气体报警器】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索