標(biāo)題:
基于stm32精英版的溫控風(fēng)扇源碼
[打印本頁]
作者:
whkang
時間:
2018-12-10 09:13
標(biāo)題:
基于stm32精英版的溫控風(fēng)扇源碼
用stm32F103ZET6精英版,溫度傳感器是DS18B20,1602液晶顯示屏,利用溫度來控制轉(zhuǎn)速,液晶顯示屏顯示實時轉(zhuǎn)速,也可手動調(diào)節(jié)轉(zhuǎn)速。(采用pi控制)
電路原理圖如下:
QQ截圖20181210091145.png
(180.04 KB, 下載次數(shù): 111)
下載附件
電路原理圖
2018-12-10 09:12 上傳
單片機源程序如下:
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "timer.h"
#include "lcd1602.h"
#include "encoder.h"
#include "control.h"
#include "usart.h"
#include "usart3.h"
#include "hc05.h"
#include "string.h"
#include "usmart.h"
#include "ds18b20.h"
u8 w=0;
int k=0;
extern int real;
vu8 key=0;
u8 reclen=0;
extern int temperature;
int main(void)
{
delay_init();
LCD_GPIO_Configuration();
LCD1602_Init();
KEY_Init();//按鍵初始化;
ENCODER_Init();
TIM2_Int_Init(19999,35);
TIM3_PWM_Init(7199,0); //不分頻。PWM頻率=72000000/900=80Khz
DS18B20_Init();
//usmart_dev.init(72); //初始化USMART
delay_ms(5000); //等待藍牙模塊上電穩(wěn)定
LCDshowNum(0,0,"EV:",SpeedSet);
LCDshowNum(0,1,"RV:", real);
LCDshowTNum(9,1,"T:",temperature);
// while(HC05_Init()) //初始化ATK-HC05模塊
//{
// delay_ms(500);
// }
// delay_ms(100);
// USART3_RX_STA=0;
while(1)
{
delay_ms(200);
temperature=(int)DS18B20_Get_Temp();
LCDshowNum(0,0,"EV:",SpeedSet);
LCDshowNum(0,1,"RV:", real);
LCDshowTNum(9,1,"T:",temperature);
key=KEY_Scan(0);
switch(key)
{
case KEY0_PRES:
SpeedSet+=100;
k++;
LCDshowNum(0,0,"EV:",SpeedSet);
break;
case KEY1_PRES:
SpeedSet-=100;
k++;
LCDshowNum(0,0,"EV:",SpeedSet);
break;
default:break;
}
if(k==0&&temperature>270)
{
SpeedSet=2200;
LCDshowNum(0,0,"EV:",SpeedSet);
}
if(k==0&&temperature<270&&temperature>250)
{
SpeedSet=2100;
LCDshowNum(0,0,"EV:",SpeedSet);
}
if(k==0&&temperature<250&&temperature>200&&temperature==200&&temperature==250)
{
SpeedSet=2000;
LCDshowNum(0,0,"EV:",SpeedSet);
}
if(k==0&&temperature<200)
{
SpeedSet=1800;
LCDshowNum(0,0,"EV:",SpeedSet);
}
}
}
復(fù)制代碼
所有資料51hei提供下載:
test1 - 1602正常 1x4鍵盤 加減調(diào)速 加溫控.rar
(368.76 KB, 下載次數(shù): 198)
2018-12-10 15:56 上傳
點擊文件名下載附件
源代碼
下載積分: 黑幣 -5
作者:
ggfg
時間:
2019-2-28 10:45
這個設(shè)計好不錯哦
作者:
清照333
時間:
2019-11-2 08:56
請問用開發(fā)板做的嗎
作者:
46856
時間:
2019-12-2 23:59
電路圖有文件嗎?
作者:
我是菜雞雞
時間:
2020-6-29 11:00
電路圖有文件嗎?
作者:
xiaowang1366
時間:
2020-7-4 15:33
電路圖是用什么畫的,有源文件嗎
作者:
paldier
時間:
2020-9-22 10:04
很棒剛好需要部分內(nèi)容
作者:
設(shè)大
時間:
2021-4-22 16:09
正準(zhǔn)備做個個小項目不錯
作者:
劉思繁
時間:
2023-2-2 10:39
我需要原理圖
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1