当前位置:网站首页>Temperature and humidity monitoring + timing alarm system based on 51 single chip microcomputer (C51 source code)
Temperature and humidity monitoring + timing alarm system based on 51 single chip microcomputer (C51 source code)
2022-04-23 13:00:00 【Outside Jinguan City】
Functional specifications :
1.DS1302 Module real-time display time ( The display time can be initialized through the program )
2.DHT11 Temperature and humidity measurement
3. Press the key to set the timing alarm time , And store the set value in 24C02 in ( After power failure, the previous setting data can be restored )
4.LCD1602 Display relevant information
matters needing attention :
processor :STC89C51/STC89C52
display :LCD1602
ROM Storage :24C02
Time to show :DS1302
Temperature and humidity measurement :DHT11
Press the key to adjust the alarm time
Chinese notes of relevant pin connection
//--- Definition lcd1602 The use of IO mouth ---//
#define LCD_DATA P0
sbit RS=P2^7;
sbit RW=P2^6;
sbit EN=P2^5;
//--- Definition Key The use of IO mouth ---//
sbit key1=P1^5;
sbit key2=P1^6;
sbit key3=P1^7;
//--- Definition ds1302 The use of IO mouth ---//
sbit SCLK=P1^2;
sbit DSIO=P1^3;
sbit RST=P1^4;
//---DS1302 Address commands for writing and reading hours, minutes and seconds ---//
//--- Second minute hour Sun Moon anniversary Lowest read / write bit ;-------//
uchar code READ_RTC_ADDR[7] = {
0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d};
uchar code WRITE_RTC_ADDR[7] = {
0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c};
//--- DS1302 Clock initialization 2021 year 3 month 8 Japan 16 spot 46 branch 00 second ---//
//--- second branch when Japan month Zhou year ---//
uchar TIME[7] = {
0, 0x46, 0x16, 0x08, 0x03, 0x01, 0x21};
uchar warn_hour,real_hour;// Alarm time , By reading the flash obtain
//--- Definition dh11 The use of IO mouth ---//
sbit dat=P2^2;
uchar DHT11[5],RTflag=0;
uchar FLAG;
//--- Definition 2402 The use of IO mouth ---//
sbit SDA=P1^1;
sbit SCL=P1^0;
//--- Definition beep The use of IO mouth ---//
sbit beep=P2^0;
uchar beep_state=1;
//--- Definition led The use of IO mouth ---//
sbit led=P2^1;
Main function code
void
main()
{
lcd_init(); //1602 initialization
init_2402(); //2402 initialization
warn_hour =read_data(0); // read out 24c02 The saved value is assigned to the alarm time
// Ds1302Init(); // Turn on when time needs to be set , By default, there is no need to set the time
while(1) // Cyclic reading And update the data display
{
Ds1302ReadTime(); // Read time
LcdDisplay(); // Display time
key_scan(); // Scan button
DHT11_5(); // Reading data
dis_str(12,0,"H:");dis_shu(14,0,warn_hour); // Display alarm time
dis_str(9,1,"S");dis_shu(10,1,DHT11[0]); // humidity
dis_str(13,1,"T");dis_shu(14,1,DHT11[2]); // temperature
warn(); // Call the police
}
}
See the comments section for links to all the information , Please leave a message if you have any questions ~
author :amusen
Time :2022.4
I wish good !
版权声明
本文为[Outside Jinguan City]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230613382659.html
边栏推荐
- Record Alibaba cloud server mining program processing
- Plato farm - a game of farm metauniverse with Plato as the goal
- Byte jump 2020 autumn recruitment programming question: quickly find your own ranking according to the job number
- 如何实现点击一下物体播放一次动画
- The quill editor image zooms, multiple rich text boxes are used on one page, and the quill editor upload image address is the server address
- Try the server for one month for free, and attach the tutorial
- SSL certificate refund instructions
- Object.keys后key值数组乱序的问题
- Important knowledge of network layer (interview, reexamination, term end)
- World Book Day: I'd like to recommend these books
猜你喜欢

Unlock openharmony technology day! The annual event is about to open!

22. 括号生成

The quill editor image zooms, multiple rich text boxes are used on one page, and the quill editor upload image address is the server address

在线计算过往日期天数,计算活了多少天

About the 'enum' enumeration type and structure.

Pytorch: a pit about the implementation of gradreverselayer

云原生KubeSphere部署Redis

SSL certificate refund instructions

Try the server for one month for free, and attach the tutorial

Kubernetes 入门教程
随机推荐
将opencv 图片转换为字节的方式
Object. The disorder of key value array after keys
Unable to create servlet under SRC subfile of idea
V-model binding value in El select, data echo only displays value, not label
Golang realizes regular matching: the password contains at least one digit, letter and special character, and the length is 8-16
Navicat远程连接数据库 出现 1130- Host xxx is not allowed to connect to this MySQL server错误
Importerror after tensorflow installation: DLL load failed: the specified module cannot be found, and the domestic installation is slow
Pytorch: a pit about the implementation of gradreverselayer
World Book Day: I'd like to recommend these books
About the 'enum' enumeration type and structure.
Bert base Chinese Download (SMART)
Jupiter notebook installation
STM32 control stepper motor (ULN2003 + 28byj)
98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
Sort out several uses of network IP agent
梳理網絡IP代理的幾大用途
Record a website for querying compatibility, string Replaceall() compatibility error
Golang implements a five insurance and one gold calculator with web interface
How to click an object to play an animation
STM32 project transplantation: transplantation between chip projects of different models: Ze to C8