Design of fire alarm based on temperature and MQ2 smoke sensor - complete course design information

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

Measure temperature and smoke real-time detection, and have high temperature alarm function and high concentration alarm function, which are displayed by LED.

#include <reg51.h>//头文件,52单片机改为52
#include <intrins.h>

#define LCD_DATA P0
sbit LCD_RS = P2^0;
sbit LCD_RW = P2^1;
sbit LCD_EN = P2^2;
unsigned char dispBuff0[16]={'T','E','M',
'P',':',' ',' ',' ',' ',' ',' ','C',' ',' ',' ',};//LCD第一行显示
unsigned char dispBuff1[16]={'D','E','N',
'S',':',' ',' ','%',' ',' ',' ',' ',' ',' ',' ',};//LCD第二行显示

sbit DQ=P2^3;  //DS18B20数据端
unsigned int temperature=0;//温度
unsigned char fuhao=0;//温度的正负符号

//AD0809的IO口以及变量定义
sbit OE=P2^7;
//sbit ALE=P3^0;
sbit EOC=P2^6;
sbit START=P3^0;
unsigned char density=0;//浓度

//LED报警指示的IO口以及变量定义
sbit LED1=P2^4;//温度报警指示
sbit LED2=P2^5;//浓度报警指示
#define off  1 		  //高电平时灯为关闭状态
#define on 0 		  //低电平时灯为开启状态

sbit speaker=P3^1;//蜂鸣器


void    Delay20ms() ;
void 	LCD_WriteDat(unsigned char lcd_dat);
void 	LCD_WriteCmd(unsigned char lcd_cmd);
unsigned char 	LCD_ReadStatus(void);
void 	LCD_Goto(unsigned char x,unsigned char y);
void    LCD_Display(unsigned char row,unsigned char *str);

void delay(unsigned int x)//延时公用程序
{
unsigned char j; 
while(x--)
    {
    for(j=0;j<125;j++);
    }
}

/*1、LCD模块子函数*/

  void 	LCD_Init(void)
{
   
   

Guess you like

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