257 [Completed Course Design] Design of Gas Leak Alarm Based on 51 Single Chip Microcomputer-LCD1602-DS18B20-MQ9

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

Gas Leak Alarm Design-LCD1602-DS18B20-RELAY-PCF8591-KEY-MQ-9

The design is composed of STC89C52 single-chip circuit + LCD602 liquid crystal display circuit + DS18B20 temperature sensor circuit + relay module circuit + A/D sampling PCF8591 circuit + sound and light alarm circuit + button circuit + MQ-9 gas sensor circuit + power supply circuit.

1. LCD1602 displays the current gas concentration and temperature in real time.

2. The gas concentration threshold setting range can be set from 210 to 990 by pressing the button. The current threshold exceeds the set threshold with sound and light alarm, and the relay is off (the relay module is closed by default). Otherwise, the sound and light will not alarm and the relay will not operate.

sbit led_gre=P1^0;		  
sbit led_yel=P1^1;		  
sbit led_red=P1^2;		  

sbit buzzer=P1^4;
sbit relay =P1^6;

unsigned int setdata = 300 ;//设置
unsigned int nongDu= 0; //浓度
unsigned char DisFlag=0;		//更新显示标志

unsigned long time20ms=0;	//定时计数

unsigned char ReadTempFlag=0;//定义读时间标志
int temp1;		//温度读取值
float temperature; //实际温度

char dis0[16];//定义显示区域临时存储数组
char dis1[16];			  //温度显示

void Init_Timer0(void);//定时器初始化
void CheckKey(void);

void main (void)
{                 
	Init_Timer0();
	LCD_Init();           //初始化液晶
	DelayMs(20);          //延时有助于稳定
	LCD_Clear();          //清屏

 

Guess you like

Origin blog.csdn.net/theroadon/article/details/109261208