STC89C52电风扇智能调速器的设计


内包括protus仿真以及protel电路原理图,keil程序运行无误,论文,并且有学习视频及软件压缩包。功能介绍:本设计为一种温控风扇系统,具有灵敏的温度感测和显示功能,系统STC89C52单片机作为控制平台对风扇转速进行控制。可由用户设置高、低温度值,测得温度值在高低温度之间时打开风扇弱风档,当温度升高超过所设定的温度时自动切换到大风档,当温度小于所设定的温度时自动关闭风扇,控制状态随外界温度而定。所设高低温值保存在温度传感器DS18B20内部E2ROM中,掉电后仍然能保存上次设定值,性能稳定,控制准确。
资源截图
代码片段和文件信息
#include  //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义
#include “intrins.h“    
#define     uchar   unsigned char
#define     uint    unsigned int
uchar yushe_wendu=40; //温度预设值高
uchar yushe_wendu_L=25; //温度预设值低
uint wendu;  //温度值全局变量

//运行模式  
uchar Mode=0;   //
//管脚声明
sbit pwm = P1^1;  
uchar f_pwm_l ;   //越小越暗

void Init_Timer0(void);
void Init_Timer1(void);
bit ReadTempFlag;//定义读时间标志


//管脚声明
sbit DQ = P1^0;  //ds18b20的数据引脚
#define   SMG_NUM   4
uchar code DisplayNum[16]={
0xc0 //0
0xf9 //1
0xa4 //2
0xb0 //3
0x99 //4
0x92 //5
0x82 //6
0xf8 //7
0x80 //8
0x90 //9
0x88 //A
0x83 //b
0xc6 //C
0xa1 //d
0x86 //E
0x8e //F
};
//
uchar code DisplayOther[]={
0xff  //0 空
0x7f  //1 “.“
0xbf //2 “-“   pgfe dcba
0xa7 //3 c     1010 0111
0x89
0xc7
};

/********************************************************************
* 名称 : delay_1ms()
* 功能 : 延时1ms函数
* 输入 : q
* 输出 : 无
***********************************************************************/
void delay_ms(uint q)
{
uint ij;
for(i=0;i for(j=0;j<110;j++);
}
//数码管位选定义
sbit smg_we1 = P2^0;     //东西数码管2
sbit smg_we2 = P2^1; //东西数码管1
sbit smg_we3 = P2^2; //南北数码管2
sbit smg_we4 = P2^3; //南北数码管1


/***********************数码位选函数*****************************/
void smg_we_switch(uchar i)
{
switch(i)
{
case 0: smg_we1 = 0;  smg_we2 = 1; smg_we3 = 1;  smg_we4 = 1; break;
case 1: smg_we1 = 1;  smg_we2 = 0; smg_we3 = 1;  smg_we4 = 1; break;
case 2: smg_we1 = 1;  smg_we2 = 1; smg_we3 = 0;  smg_we4 = 1; break;
case 3: smg_we1 = 1;  smg_we2 = 1; smg_we3 = 1;  smg_we4 = 0; break;
}
}




/********************************************************************
* 名称 : uchar ChangeFor(uchar dat)
* 功能 : 交换一个字节位的位置用于数码管显示
* 输入 : 需要改变的数
* 输出 : 改变后的数
***********************************************************************/
#define LED_a 0 //数码管段选的a段接在段选IO口的第0位
#define LED_b 2
#define LED_c 6
#define LED_d 4
#define LED_e 3
#define LED_f 1
#define LED_g 7
#define LED_dp 5

uchar ChangeFor(uchar dat)
{
uchar temp=0;
if(dat&0x01) //判断数据的第一位是否为1
temp|=0x01< if(dat&0x02)
temp|=0x01< if(dat&0x04)
temp|=0x01< if(dat&0x08)
temp|=0x01< if(dat&0x10)
temp|=0x01< if(dat&0x20)
temp|=0x01< if(dat&0x40)
temp|=0x01< if(dat&0x80)
temp|=0x01< return temp;
}
uchar dis_smg[SMG_NUM]; //显示缓存数组

/********************************************************************
* 名称 : display()
* 功能 : 数码管显示
* 输入 : 无
* 输出 : 无
***********************************************************************/
void DisplayScan()
{
static uchar i;
P0 = 0xff;           //消隐 
smg_we_switch(i);      //位选
P0 = ChangeFor(dis_smg[i]);   //段选   
i++;
if(i>=SMG_NUM)
i=0;
}

/*****延时子程序:该延时主要用于ds18b20延时*****/
void Delay_DS18B20(in

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-06-01 08:33  1设计资料
     目录           0  2017-05-31 15:16  1设计资料1__c程序+注释
     目录           0  2017-05-31 15:16  1设计资料1__c程序+注释Debug
     文件       33792  2017-04-26 19:03  1设计资料1__c程序+注释Debugvc60.idb
     文件       28672  2017-04-26 19:03  1设计资料1__c程序+注释Debugvc60.pdb
     目录           0  2017-05-31 15:16  1设计资料1__c程序+注释keil4版
     文件       16325  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇
     文件       10760  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.c
     文件        5617  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.hex
     文件          56  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.lnp
     文件       23944  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.LST
     文件       23058  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.M51
     文件       18676  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.OBJ
     文件        1068  2017-05-24 19:30  1设计资料1__c程序+注释keil4版智能温控风扇.plg
     文件       71951  2017-04-26 16:42  1设计资料1__c程序+注释keil4版智能温控风扇.uvgui.Zhang Liqiang
     文件       71951  2017-04-26 16:43  1设计资料1__c程序+注释keil4版智能温控风扇.uvgui_Zhang Liqiang.bak
     文件       54918  2017-05-24 21:20  1设计资料1__c程序+注释keil4版智能温控风扇.uvopt
     文件       13290  2017-04-26 19:14  1设计资料1__c程序+注释keil4版智能温控风扇.uvproj
     文件       54918  2017-05-15 18:55  1设计资料1__c程序+注释keil4版智能温控风扇_uvopt.bak
     文件       13476  2017-04-26 16:42  1设计资料1__c程序+注释keil4版智能温控风扇_uvproj.bak
     文件         162  2017-04-27 16:18  1设计资料1__c程序+注释~$智能温控风扇.docx
     文件       10734  2017-04-26 16:41  1设计资料1__c程序+注释智能温控风扇.c
     文件       24861  2017-04-28 13:05  1设计资料1__c程序+注释智能温控风扇.docx
     文件        3473  2017-04-26 19:03  1设计资料1__c程序+注释智能温控风扇.dsp
     文件         532  2017-04-26 21:47  1设计资料1__c程序+注释智能温控风扇.dsw
     文件       33792  2017-04-26 21:47  1设计资料1__c程序+注释智能温控风扇.ncb
     文件       48640  2017-04-26 21:47  1设计资料1__c程序+注释智能温控风扇.opt
     文件        1355  2017-04-26 19:03  1设计资料1__c程序+注释智能温控风扇.plg
     文件       10734  2017-04-26 16:41  1设计资料1__c程序+注释智能温控风扇.txt
     目录           0  2017-06-01 08:10  1设计资料2__原理图
     文件       43305  2017-05-31 20:35  1设计资料2__原理图Backup of Backup of 智能温控风扇 - 硬件电路.sch
............此处省略153个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)