本文档是使用数码管和DS18B20设计温度报警器的程序和仿真电路图免费下载
上传时间: 2022-05-02
上传用户:d1997wayne
STM32F103开发板 DHT11温湿度DS18B20 气体MQ-2光敏声控雨滴传感器实验程序**--------------------------------------------------------------------------------------------------------** Created by: FiYu** Created date: 2015-12-12** Version: 1.0** Descriptions: DHT11温湿度传感器实验 **--------------------------------------------------------------------------------------------------------** Modified by: FiYu** Modified date: ** Version: ** Descriptions: ** Rechecked by: **********************************************************************************************************/#include "stm32f10x.h"#include "delay.h"#include "dht11.h"#include "usart.h"DHT11_Data_TypeDef DHT11_Data;/************************************************************************************** * 描 述 : GPIO/USART1初始化配置 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); GPIO_DeInit(GPIOB); //将外设GPIOA寄存器重设为缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出 GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_DeInit(GPIOA); //将外设GPIOA寄存器重设为缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //推挽输出 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空输入 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOB , GPIO_Pin_9); //初始状态,熄灭指示灯LED1}/************************************************************************************** * 描 述 : 串口显示实时温湿度 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/void DHT11_SCAN(void){ if( Read_DHT11(&DHT11_Data)==SUCCESS) { printf("\r\n读取DHT11成功!\r\n\r\n湿度为%d.%d %RH ,温度为 %d.%d℃ \r\n",\ DHT11_Data.humi_int,DHT11_Data.humi_deci,DHT11_Data.temp_int,DHT11_Data.temp_deci); //printf("\r\n 湿度:%d,温度:%d \r\n" ,DHT11_Data.humi_int,DHT11_Data.temp_int); } else { printf("Read DHT11 ERROR!\r\n"); }}/************************************************************************************** * 描 述 : MAIN函数 * 入 参 : 无 * 返回值 : 无 **************************************************************************************/int main(void){ SystemInit(); //设置系统时钟72MHZ GPIO_Configuration(); USART1_Init(); //初始化配置TIM DHT11_GPIO_Config(); // 初始化温湿度传感器PB1引脚初始时为推挽输出 GPIO_ResetBits(GPIOB , GPIO_Pin_9); delay_ms(500); while(1) { GPIO_SetBits(GPIOB , GPIO_Pin_9); DHT11_SCAN(); //实时显示温湿度 delay_ms(1500); } }
上传时间: 2022-05-03
上传用户:得之我幸78
关于用1602LCD与DS18B20设计的温度报警器的超实用实验,适合感兴趣的学习者学习,可以提高自己的能力,大家可以多交流哈
上传时间: 2022-05-19
上传用户:默默
基于AVR单片机的用DS18B20与MAX6951驱动数码管设计的温度报警器实验,适合感兴趣的学习者学习,可以提高自己的能力,大家可以多交流哈
标签: avr 单片机 ds18b20 max6951 驱动
上传时间: 2022-05-19
上传用户:aben
说明: 完整的电动车防盗报警器源码,单片机:EMC78P153S,源码注释清晰(Complete electric vehicle anti-theft alarm source, Microcontroller: EMC78P153S, Notes of a clear source)
上传时间: 2022-06-06
上传用户:默默
数码管温度报警器功能介绍:采用DS18B20采集温度数码管显示温度可通过按键设定上限和下限温度的报警值高于上限温度或是低于下限温度都会进行声光报警测温范围-55到125度显示精度为0.1度
上传时间: 2022-06-20
上传用户:
在8086 Proteus下的电压报警器,南通大学微机原理课程设计电压报警器
上传时间: 2022-06-30
上传用户:
基于TDC-GP22的超声波气体流量计设计
上传时间: 2022-07-08
上传用户:trh505
居家安全,51单片机助力温度火灾烟雾报警器,仿真及程序
上传时间: 2022-07-10
上传用户:
基于51单片机设计的红外热释电的人体感应报警器原理图和源码
上传时间: 2022-07-16
上传用户:fliang