单片机源程序如下:
- #include "led.h"
- #include "buzzer.h"
- #include "switch.h"
- #include "button.h"
- #include "delay.h"
- #include "eint.h"
- #include "wdt.h"
- #include "uart.h"
- #include "lcd.h"
- #include "ds18b20.h"
- #include "dht.h"
- #include "pm.h"
- #include "rtc.h"
- #include "stdio.h"
- int main(void)
- {
- char T_Buf[10] = {0};
- char D_Buf[5] = {0};
- int pm_value;
- struct time_st t = {17, 9, 20, 3, 16,33, 0};
- char time[20] = {0};
-
- // YY-MM-DD W hh:mm:ss
-
- led_init();
- buzzer_init();
- switch_init();
- delay_init();
- eint_init();
- uart_init();
- LCD_Init();
- DS18B20_Init();
- dht_init();
- pm_init();
- rtc_init(&t);
-
- BRUSH_COLOR = RED;
- BACK_COLOR = GREEN;
-
- LCD_Clear(BACK_COLOR);//绿色背景
-
- LCD_DisplayMyName(10, 10);
- LCD_DisplayString(10, 40, 24, (u8 *)"ZaCk.MeGaMiNd");
-
- while(1)
- {
- get_time(&t);
- get_temperature(T_Buf);
- get_dht_data(D_Buf);
- pm_value = get_pm_data();
- sprintf(time, "%02d-%02d-%02d %02d %02d:%02d:%02d", t.Y, t.M, t.D, t.W, t.h, t.m, t.s);
- LCD_DisplayString(10, 65, 24, (u8 *)T_Buf);
- LCD_DisplayNum(10, 90, D_Buf[0], 2, 24, 0);
- LCD_DisplayNum(10, 115, D_Buf[2], 2, 24, 0);
- LCD_DisplayNum(10, 140, pm_value, 4, 24, 0);
- LCD_DisplayString(0, 200, 24, (u8 *)time);
- delay_ms(1000);
- }
- }
复制代码
所有资料51hei提供下载:
开发板原理图.zip
(261.95 KB, 下载次数: 34)
18rtc.7z
(301.73 KB, 下载次数: 38)
stm32笔记.pdf
(3.87 MB, 下载次数: 28)
|