欢迎来到天天文库
浏览记录
ID:55076404
大小:54.00 KB
页数:13页
时间:2020-04-26
《基于单片机的智能火灾报警系统设计源程序代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、....#include//调用单片机头文件#defineucharunsignedchar//无符号字符型宏定义变量围0~255#defineuintunsignedint//无符号整型宏定义变量围0~65535#include#include"lcd1602.h"#include"eeprom52.h"sbitCS=P2^4;//CS定义为P2口的第4位脚,连接ADC0832CS脚sbitSCL=P2^3;//SCL定义为P2口的第3位脚,连接ADC0832SCL脚sbitDO=P2^2;//DO
2、定义为P2口的第2位脚,连接ADC0832DO脚sbitdq=P2^0;//18b20IO口的定义sbitbeep=P3^2;//蜂鸣器IO口定义uinttemperature,s_temp;//温度的变量ucharyanwu,s_yanwu;//烟物等级ucharshoudong;//手动报警键bitflag_300ms;ucharkey_can;//按键值的变量ucharmenu_1;//菜单设计的变量bitkey_500ms;ucharphone1_i=0;//是多少位ucharphone2_i=0;//是多少位ucharphone1
3、_call[11]={""};ucharphone2_call[11]={""};uchardis_smg[11];/***********************1ms延时函数*****************************/voiddelay_1ms(uintq){uinti,j;for(i=0;i4、um).下载可编辑.....{for(i=0;i5、emp);byte_write(0x2015,s_yanwu);byte_write(0x2016,a_a);byte_write(0x2020,phone2_call[0]);byte_write(0x2021,phone2_call[1]);byte_write(0x2022,phone2_call[2]);byte_write(0x2023,phone2_call[3]);byte_write(0x2024,phone2_call[4]);byte_write(0x2025,phone2_call[5]);byte_write(0x26、026,phone2_call[6]);byte_write(0x2027,phone2_call[7]);byte_write(0x2028,phone2_call[8]);byte_write(0x2029,phone2_call[9]);byte_write(0x2030,phone2_call[10]);}/******************把数据从单片机部eeprom中读出来**读***************/voidread_eeprom(){for(i=0;i<11;i++)phone1_call[i]=byte_read7、(0x2000+i);phone1_i=byte_read(0x2012);phone2_i=byte_read(0x2013);s_temp=byte_read(0x2014);s_yanwu=byte_read(0x2015);a_a=byte_read(0x2016);phone2_call[0]=byte_read(0x2020);phone2_call[1]=byte_read(0x2021);phone2_call[2]=byte_read(0x2022);.下载可编辑.....phone2_call[3]=byte_read(8、0x2023);phone2_call[4]=byte_read(0x2024);phone2_call[5]=byte_read(0x2025);phone2_call[6]=
4、um).下载可编辑.....{for(i=0;i5、emp);byte_write(0x2015,s_yanwu);byte_write(0x2016,a_a);byte_write(0x2020,phone2_call[0]);byte_write(0x2021,phone2_call[1]);byte_write(0x2022,phone2_call[2]);byte_write(0x2023,phone2_call[3]);byte_write(0x2024,phone2_call[4]);byte_write(0x2025,phone2_call[5]);byte_write(0x26、026,phone2_call[6]);byte_write(0x2027,phone2_call[7]);byte_write(0x2028,phone2_call[8]);byte_write(0x2029,phone2_call[9]);byte_write(0x2030,phone2_call[10]);}/******************把数据从单片机部eeprom中读出来**读***************/voidread_eeprom(){for(i=0;i<11;i++)phone1_call[i]=byte_read7、(0x2000+i);phone1_i=byte_read(0x2012);phone2_i=byte_read(0x2013);s_temp=byte_read(0x2014);s_yanwu=byte_read(0x2015);a_a=byte_read(0x2016);phone2_call[0]=byte_read(0x2020);phone2_call[1]=byte_read(0x2021);phone2_call[2]=byte_read(0x2022);.下载可编辑.....phone2_call[3]=byte_read(8、0x2023);phone2_call[4]=byte_read(0x2024);phone2_call[5]=byte_read(0x2025);phone2_call[6]=
5、emp);byte_write(0x2015,s_yanwu);byte_write(0x2016,a_a);byte_write(0x2020,phone2_call[0]);byte_write(0x2021,phone2_call[1]);byte_write(0x2022,phone2_call[2]);byte_write(0x2023,phone2_call[3]);byte_write(0x2024,phone2_call[4]);byte_write(0x2025,phone2_call[5]);byte_write(0x2
6、026,phone2_call[6]);byte_write(0x2027,phone2_call[7]);byte_write(0x2028,phone2_call[8]);byte_write(0x2029,phone2_call[9]);byte_write(0x2030,phone2_call[10]);}/******************把数据从单片机部eeprom中读出来**读***************/voidread_eeprom(){for(i=0;i<11;i++)phone1_call[i]=byte_read
7、(0x2000+i);phone1_i=byte_read(0x2012);phone2_i=byte_read(0x2013);s_temp=byte_read(0x2014);s_yanwu=byte_read(0x2015);a_a=byte_read(0x2016);phone2_call[0]=byte_read(0x2020);phone2_call[1]=byte_read(0x2021);phone2_call[2]=byte_read(0x2022);.下载可编辑.....phone2_call[3]=byte_read(
8、0x2023);phone2_call[4]=byte_read(0x2024);phone2_call[5]=byte_read(0x2025);phone2_call[6]=
此文档下载收益归作者所有