基于stm32单片机游泳池水温监测控制系统Proteus仿真和源程序全套资料

 一:功能介绍

1、采用stm32单片机+LCD1602+DS18B20温度传感器+蜂鸣器+按键+电机,制作一个基于stm32单片机游泳池水温监测控制系统;

2、通过按键进行设置温度的阈值,并且显示到LCD1602显示屏上面;

3、DS18B20传感器检测实时温度,显示到LCD1602显示屏上面;

4、当实时检测的温度低于设置的温度阈值,开启蜂鸣器提醒,并且打开加热电机进行加热;

二:仿真演示视频+程序简要讲解:(程序有中文注释,新手容易看懂)

130-基于stm32单片机游泳池水温监测控制系统Proteus仿真+源程序

三:设计软件介绍

本设计使用C语言编程设计,程序代码采用keil5编写,程序有中文注释,新手容易看懂,仿真采用Proteus软件进行仿真演示视频使用的是Proteus8.9版本;资料包里有相关软件包,可自行下载安装。

四:程序打开方法

特别注意:下载资料包以后一定要先解压!(建议解压到桌面上,文件路径太深会导致程序打开异常),解压后再用keil5打开。

4dd3a5b447b35cb66eaee8aafb5d18ef.png

45e1cb9ea8b4147e3d5aad7bdc00cd74.png

程序部分展示,有中文注释,新手容易看懂
  //按键扫描,获取按键状态
/*****************引脚配置********************/
void GPIO_Configuration(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);


  //LCD1602 管脚      
  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_8| GPIO_Pin_9| GPIO_Pin_10| GPIO_Pin_11| GPIO_Pin_12| GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;  
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 |GPIO_Pin_6|GPIO_Pin_5;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;  
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOB, &GPIO_InitStructure);  


}
void IO_out( void )
{
  GPIO_InitTypeDef GPIO_InitStructure;
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC ,ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
  //按键
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0| GPIO_Pin_1| GPIO_Pin_2| GPIO_Pin_3;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;;
  GPIO_Init(GPIOC, &GPIO_InitStructure);  


  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOC, &GPIO_InitStructure);  


}
void Delay_DS18B20(int num)
{
  while(num--) ;
}


void anjiansaomiao(void)
{


  //表明按下 
  if(k1 == 1)
  {  
    wenduset++;  while(k1!=0);  
    if(wenduset>100) wenduset=100;        
  }
    
  //表明按下 
  if(k2 == 1)
  {
    wenduset--;  while(k2!=0);  
    if(wenduset<1) wenduset=1;
  }  


}
int main(void)
{
  int t;
  short tem,tem1;
  GPIO_Configuration();//初始化     
  Init1602(); 
  IO_out();
  delay_init();
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  GPIO_InitTypeDef g;
  g.GPIO_Mode = GPIO_Mode_Out_PP;
  g.GPIO_Speed = GPIO_Speed_10MHz;
  g.GPIO_Pin = GPIO_Pin_8  ;
  GPIO_Init(GPIOA,&g);
   GPIO_SetBits(GPIOA,GPIO_Pin_8);    //输出1


   t=DS18B20_DQ_IN;
while(t){
    DS18B20_IO_OUT();   //SET PG11 OUTPUT


    DS18B20_DQ_OUT=0;   //拉低DQ
    Delay_DS18B20(750);       //拉低750us
    DS18B20_DQ_OUT=1;   //DQ=1 
    Delay_DS18B20(15);       //15US
    DS18B20_IO_IN();  //SET PG11 INPUT   
    Delay_DS18B20(100);
    t=DS18B20_DQ_IN;
}
     tem=DS18B20_Get_Temp();//读取温度


  Delay_DS18B20(1000000);
  while(1)
  {
    tem=DS18B20_Get_Temp();//读取温度
if(  tem>0)         
  {  
  WrByte1602(0,8,'+'); 
  WrByte1602(0,9,AsciiCode[tem%1000/100]);//显示+温度
  WrByte1602(0,10,AsciiCode[tem%100/10]);
  WrByte1602(0,12,AsciiCode[tem%10]);
        
  }
  else 
  {  
    tem1=-(tem);
    tem1=tem1+1;
  WrByte1602(0,8,'-'); 
  WrByte1602(0,9,AsciiCode[tem1%1000/100]);//显示-温度
  WrByte1602(0,10,AsciiCode[tem1%100/10]);
  WrByte1602(0,12,AsciiCode[tem1%10]);
    
  }
      anjiansaomiao();//扫描按键  
  
  WrByte1602(1,10,AsciiCode[wenduset%1000/100]);  //显示设置温度
  WrByte1602(1,11,AsciiCode[wenduset%100/10]);
  WrByte1602(1,12,AsciiCode[wenduset%10]);
 
  if(tem/10<wenduset)  PCout(10)=0;//温度小于设置值  开启加热和提醒
  else  PCout(10)=1;
  WrByte1602(0,1,' '); //字符显示
  WrByte1602(0,2,'T'); 
  WrByte1602(0,3,'E'); 
  WrByte1602(0,4,'M'); 
  WrByte1602(0,5,'P'); 
  WrByte1602(0,6,'='); 
  WrByte1602(1,1,' '); //字符显示
  WrByte1602(1,2,' '); 
  WrByte1602(1,3,'S'); 
  WrByte1602(1,4,'E'); 
  WrByte1602(1,5,'T'); 
  WrByte1602(1,6,'='); 
  WrByte1602(0,11,'.');   
  WrByte1602(0,14,'C'); 
  WrByte1602(1,14,'C');

:仿真文件(采用Proteus打开)

47335981fefd6fecac18fb7705dbb2d4.png

166da6f61065d616169fe4480326d0a8.png

6920b3531551cc81b159eb9ea2c6e053.png

六:资料清单展示(文件中包含的相关资料)

975d0bd3f1ed0f1c2dbd910ac304ba85.png

资料下载链接(可点击)

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值