Smoke and temperature alarm based on single-chip microcomputer-fire monitoring-complete course design information

[Resource download] The download address is as follows:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

Description: K1 setting button is used to set the alarm temperature and smoke density. K2 increases and K3 decreases. K4 is confirmed, only the alarm value set after confirmation is valid. After setting the alarm value, it will alarm when the temperature or smoke concentration reaches the set value.

sbit K1= P1^2;
sbit K2= P1^3;
sbit K3= P1^4;
sbit K4= P1^5;
sbit K5= P1^6;
sbit K6= P1^7;
sbit DQ= P2^7;

sbit BUZZ= P2^6;

 
uchar tmpdisplay[8]; //定义显示缓存数组
bit read_flag=0;	//定义读时钟标志位
bit mode=0;	  		//显示模式0正常1设定

uchar set_position=0;

uchar set_tempure=0;     //设定温度
uchar set_smokescope=0;	 //设定浓度
int real_tempure=0;		//实际温度
uchar real_smokescope=0; //实际烟雾浓度

uchar cursor_position=0;//光标位置
	
uchar  time_counter_50ms=0;
uchar  smokescope=0;
uchar  first_read_tempe=0;//第一次读取温度数值


unsigned char t[2],*pt;				//用来存放温度值,测温程序就是通过这个数组与主函数通信的
unsigned char  TempBuffer1[10]={0x2b,0x30,0x30,0x30,0x2e,0x30,0x30,0xdf,0x43,'\0'};//{0x2b,0x31,0x32,0x32,0x2e,0x30,0x30,0xdf,0x43,'\0'};
								//显示实时温度,上电时显示+122.00C
/*
unsigned char  TempBuffer0[16]={0x54,0x48,0x3a,0x2b,0x31,0x32,0x35,0x20,
								0x54,0x4c,0x3a,0x2b,0x31,0x32,0x34,'\0'};	*/
								//显示温度上下限,上电时显示TH:+125 TL:+124C							
unsigned char code dotcode[4]={0,25,50,75};


/***因显示分辨率为0.25,但小数运算比较麻烦,故采用查表的方法*******
再将表值分离出十位和个位后送到十分位和百分位********************/

void covert1(void)	//将温度转换为LCD显示的数据
{
	
   unsigned char x=0x00,y=0x00;

Guess you like

Origin blog.csdn.net/AuroraFaye/article/details/115052656