当前位置:网站首页>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
边栏推荐
- Huawei cloud MVP email
- 如何实现点击一下物体播放一次动画
- Golang realizes regular matching: the password contains at least one digit, letter and special character, and the length is 8-16
- BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
- Record a website for querying compatibility, string Replaceall() compatibility error
- Record Alibaba cloud server mining program processing
- Use source insight to view and edit source code
- SSL certificate refund instructions
- HQL find the maximum value in a range
- SSM框架系列——注解开发day2-2
猜你喜欢
Free and open source agricultural Internet of things cloud platform (version: 3.0.1)
Trier les principales utilisations de l'Agent IP réseau
SSM框架系列——数据源配置day2-1
CVPR 2022&NTIRE 2022|首个用于高光谱图像重建的 Transformer
STM32 is connected to the motor drive, the DuPont line supplies power, and then the back burning problem
Kubernetes 入门教程
There is no need to crack the markdown editing tool typora
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
Summary of JVM knowledge points - continuously updated
CGC: contractual graph clustering for community detection and tracking
随机推荐
SSM框架系列——注解开发day2-2
C, calculation code of parameter points of two-dimensional Bezier curve
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
Go language slicing operation
21 天学习MongoDB笔记
SQL exercise question 1
Translation of attention in natural language processing
If you were a golang interviewer, what questions would you ask?
内核错误: No rule to make target ‘debian/canonical-certs.pem‘, needed by ‘certs/x509_certificate_list‘
JDBC connection pool
Use of Presto date function
Plato farm - a game of farm metauniverse with Plato as the goal
Software testing weekly (issue 68): the best way to solve difficult problems is to wait and see the changes and push the boat with the current.
CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
4.DRF 权限&访问频率&过滤&排序
Sort out several uses of network IP agent
[Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)
CVPR 2022&NTIRE 2022|首个用于高光谱图像重建的 Transformer
21 days learning mongodb notes
Luogu p3236 [hnoi2014] picture frame solution