毕业设计基于STC89C52单片机的窗帘设计_第1页
毕业设计基于STC89C52单片机的窗帘设计_第2页
毕业设计基于STC89C52单片机的窗帘设计_第3页
毕业设计基于STC89C52单片机的窗帘设计_第4页
毕业设计基于STC89C52单片机的窗帘设计_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、河南理工大学本科课程设计报告河南理工大学微机原理与单片机接口技术课程设计报告题目: 基于单片机的遥控窗帘设计 姓 名: 学 号: 专业班级: 指导老师: 所在学院: 电气工程与自动化学院 2013年4月5日摘 要 本实验装置是以单片机stc89c52为控制核心的遥控窗帘,通过键盘控制和无线远程遥控实现遥控窗帘不同的工作模式以及对窗帘的位置,通过霍尔传感器反馈信号控制。遥控窗帘的不同模式通过三种不同颜色的发光二极管进行显示。每次进行模式切换时能实现窗帘的拉开与拉住,窗帘的开合是用一个由l298n驱动芯片驱动的5v的直流电机的正反转带动实现的。此电子设计,总体来说,从功能上来说较为简单,从成本上来

2、说造价低,经济实用,利于推广,能够满足智能家居要求。关键字:stc89c52 单片机 霍尔传感器 l298n 直流电机 无线控制模块目 录 第一章 概述31.1 引言31.2基本要求3第二章 基本硬件系统的设计与功能实现42.1 stc89c52单片机简介42.2 l298电机驱动芯片42.3无线电遥控接收模块62.4防过卷模块6第三章 软件设计93.1 流程图93.2 总程序9第四章 proteus仿真104.1仿真图104.2仿真图说明10第五章 课程设计体会11参考文献:12附1:源程序代码13附2:系统原理图17第一章 概述1.1 引言随着国民经济的发展和科学技术水平的提高,特别是计算

3、机技术,通信技术,网络技术,控制技术的迅猛发展,生活现代化得以实现,居住环境向舒适化,安全化发展,家居智能化在这种形式下应运而生。因此,我们组经过共同的讨论和深入考虑决定做遥控窗帘。我们的作品采用了stc89c52单片机进行了简单的设计,并通过驱动放大电路驱动电机,中间还设有控制不同模式遥控窗帘开关控制电路。1.2基本要求1.利用直流电机正反转实现控制窗帘的开关。2. 防过卷功能。3. 具有无线遥控和手动按键控制两种功能。4. 能够指示运行状态。第二章 基本硬件系统的设计与功能实现本系统采用stc89c52单片机作为主控制核心部件,主要通过按键和远程控制信号来实现电机的驱动的控制信号。以下是基

4、于单片机的遥控窗帘设计的各部分介绍:2.1 stc89c52单片机简介stc89c52单片机是一种低功耗、高性能cmos8位微控制器,具有8k 在系统可编程flash 存储器。使用atmel 公司高密度非易失性存储器技术制造,与工业80c51 产品指令和引脚完全兼容。片上flash允许程序存储器在系统可编程,亦适于常规编程器。在单芯片上,拥有灵巧的8 位cpu 和在系统可编程flash,使得stc89c52单片机在众多嵌入式控制应用系统中得到广泛应用。2.2 l298电机驱动芯片l298可直接的对电机进行控制,无需隔离电路。通过单片机的i/o输入改变芯片的控制端的电平,即可以对电机进行正反转,

5、停止的操作,非常方便,亦能满足直流减速及输出大电流要求。表 1 是 l298n 功能逻辑图:ena(b)in1(in3)in2(in4)电机运行状况hhl正转hlh反转h同in2(in4)同in1(in3)快速停止lxx停止表1 l298n逻辑功能表下图是其引脚图:图1l298n图2l298n控制电机1和15和8引脚直接接地。4管脚vs接2.5到46的电压,它是用来驱动电机的。9引脚是用来接4.5到7v的电压的,它是用来驱动l298芯片的。6和11引脚是使能端,一个使能端控制一个电机工作。5,7,10,12是298的信号输入端和单片机的io口相连。2,3,13,14是输出端。输入5和7控制输出

6、2和3, 输入的10,12控制输出的13,14。在我们的课程设计中,只用到了一个电机,用5、7管脚控制2、3管脚的输出来控制电机的正反转以及调速功能。2.3无线电遥控接收模块2722是一个解码芯片,其地址是通过2722的管脚进行的硬件编码的,每个遥控器与接收模块对应,遥控上的按键a、b、c、d对应接收模块上的a、b、c、d管脚,当按下遥控器上的按键时,接收模块对应管脚便成为了高电平锁存输出,同时i管脚输出正脉冲,我们的课设中a、b、c、i分别与单片机的i/o口p1.0、p1.1、p1.2、p1.3连接检测无线信号,通过相应的无线电遥控信号来控制系统的状态。2.4防过卷模块这个窗帘是通过电机带动

7、从左往右打开,所以这里设计两个霍尔传感器,一个设计在窗帘导轨的最左边,用于检测窗帘是否已完全关闭;另一个设计在窗帘的最右边,用于检测窗帘是否已完全打开,从而防止由于电机长时间通电而损坏。本装置用到的霍尔传感器的介绍:霍尔传感器是一种磁传感器。用它可以检测磁场及其变化,可在各种与磁场有关的场合中使用。由于霍尔元件产生的电势差很小,故通常将霍尔元件与放大器电路、温度补偿电路及稳压电源电路等集成在一个芯片上,称之为霍尔传感器。如图2所示图 3霍尔传感器霍尔传感器分为线性型霍尔传感器和开关型霍尔传感器两种。我们用到的是开关型霍尔传感器,由稳压器、霍尔元件、差分放大器,斯密特触发器和输出级组成,它输出数

8、字量。本次所采用的是闭锁性的霍尔传感器,其特性如图5所示。当磁感应强度超过动作点bop时,传感器输出由高电平跃变为低电平,而在外磁场撤消后,其输出状态保持不变(即锁存状态),必须施加反向磁感应强度达到brp时,才能使电平产生变化。图4闭锁性特性所以,通过将霍尔传感器至于窗帘的最左端和最右端,使得当窗帘打开到最右,闭合到最左时,能够自动发送信号关闭电机。防过卷电路如下 图5防卷电路图如图所示,对应的端口分别接对应的地与+5v。当有磁铁靠近时,输出为高电平。当窗帘拉开时,达到指定的位置时,对应的输出为高电平,电机停转。当窗帘关闭时,到达指定的位置时,对应的输出为高电平,电机停转。第三章 软件设计延

9、迟 是否有按键按下键盘扫描开始nync按下检测哪个键按下ya按下反转b按下正转停止3.1 流程图3.2 总程序总程序见附1第四章 proteus仿真4.1仿真图4.2仿真图说明该系统主要有按键控制模块,发光二极管指示模块,cpu控制模块,l298驱动电机模块。三个按键分别接单片机p0.5、p0.6 、p0.7,分别控制电机正转、反转、停机三种工作状态。绿黄红三个发光二极管分别指示窗帘的正转与反转以及停止。l298是驱动电机的部分,由单片机引出p2.0、p2.1、 p2.2控制驱动的输入端和使能端in1、in2、ena,驱动的输出端out1、out2则连到电机两端。工作时,当按下按键1,经过p2

10、.0,p1.1分别输出高低电平,然后由驱动输出out1,out2管脚的高低电平,电机正转,绿灯亮;当按下按键2,电机反转,黄灯亮。当按下按键3时,让电机停转。第五章 课程设计体会这次课程设计是对上学期微机原理与单片机接口技术课程的巩固,虽然为期比较长,但是还是有许多设计不够完美,在硬件设计上考虑不周全,虽然基本功能可以实现,但设计不太实用,需要改进。在拿到课程设计题目之后,选定这个题目主要是主观认为该题目比较有趣,有挑战性,与其他几个相比,有发散思维,提高动手能力的效果。怀着比较期待以及兴奋的心情,在寒假里,我们组内两人都开始着手准备,搜集相关资料,主要是根据要实现的功能确立怎么实现相应功能的

11、方案,在此基础上,通过看前辈们的设计,查阅相关芯片的功能原理,引脚以及接线,搞清每一块的具体如何接线,如何实现。而其中主要就是无线控制模块的接入,l289驱动控制模块的连接以及工作原理,较难的就是霍尔传感器防过卷控制模块的设计。由于我们利用的是上学期做好的单片机控制板,按键,指示灯等都已经设计好,所以只需要通过软件控制写程序实现手动按键控制和显示功能,这为我们的设计省去了很多麻烦。而电机正反转以及无线控制相对也比较简单,只要了解了相应硬件功能,很容易实现。另外,写程序相对于上学期我们做过的四个实验的复杂程度,这个算是相当简单。最复杂以及耗费时间的就是硬件构架设计,本以为很简单,结果在实现正反转

12、的设计上遇到了很大麻烦,最后的设计算是差强人意。防过卷模块的安装也比较麻烦。虽然做这个设计花费了很长时间和精力,但是同时我们也有很多收获,任何看似简单的事情,如果认真去做,都会有很多可探寻的技巧,做实验需要耐心细心用心,切不可眼高手低,心浮气躁。通过这个实验,让我认识到单片机功能的强大,基于单片机,我们可以通过接各种各样的外设,实现各种不同功能,有待我们去探索。 21参考文献:1 杨凌霄,王丽微机原理与单片机接口技术中国电力出版社,2012,231-3762 郭天祥51单片机c语言教程中国电子工业出版社,2009-01-013 邱关源,罗先觉电路高等教育出版社,2006-03-01,115-1

13、204 百度文库l298中文资料, 5 百度文库2262/2272编解码集成电路介绍,6 百度文库霍尔传感器的原理与应用,附1:源程序代码#include# define uchar unsigned char;# define uint unsigned int;sbit in1=p20; /in端口定义sbit in2=p21;sbit ena=p22; /使能端定义sbit g=p23; /指示灯端口定义sbit y=p24;sbit r=p25;sbit k1=p05; /按钮端口定义sbit k2=p06;sbit k3=p07;sbit w1=p10; /遥控器端口定义sbit w

14、2=p11;sbit w3=p12;sbit i=p13;sbit h=p26; /霍尔传感器端口定义sbit m=p36;void delay (int i)/延时子程序char x,y;for(x=i;x0;x-)for(y=100;y0;y-);void main() m=0;ena=0;g=y=r=1;while(1) if(i=0) /按键控制程序 if(k1=0)/正转 delay(5); while(1) g=0;y=1;r=1; ena=1;in1=1;in2=0; delay(10); ena=1;in1=0;in2=0; delay(20); if(k2=0|k3=0|h=

15、1|i=1) break; if(k2=0)/反转 delay(5); while(1) g=1;y=0;r=1; ena=1;in1=0;in2=1; delay(10); ena=1;in1=0;in2=0; delay(20); if(k1=0|k3=0|h=1|i=1) break; if(k3=0|h=1)/停止 g=1;y=1;r=0; ena=0;in1=0;in2=0; if(i=1) /无线遥控控制程序 while(w1=1) /正转 g=0;y=1;r=1; ena=1;in1=1;in2=0; delay(10); ena=1;in1=0;in2=0; delay(20)

16、; if(k1=0|k2=0|k3=0|h=1) break; while(w2=1) /反转 g=1;y=0;r=1; ena=1;in1=0;in2=1; delay(10); ena=1;in1=0;in2=0; delay(20); if(k1=0|k2=0|k3=0|h=1) break; if(w3=1) /停止 g=1;y=1;r=0; ena=0;in1=0;in2=0; 附2:系统原理图g an employment tribunal claiemployment tribunals sort out disagreements between employers and e

17、mployees.you may need to make a claim to an employment tribunal if: you dont agree with the disciplinary action your employer has taken against you your employer dismisses you and you think that you have been dismissed unfairly.for more information about dismissal and unfair dismissal, seedismissal.

18、you can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. however, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.remember that in most cases you

19、must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. if your application is received after this time limit, the tribunal will not usually accept i.if you are worried about how the time limits apply to you, take advice f

20、rom one of the organisations listed underfurther help.employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation.most people find making a claim to an employment tribunal challenging. if you are thinkin

21、g about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed underfurther help.if you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win th

22、e case. this is known as adamages-based agreement. in england and wales, your solicitor cant charge you more than 35% of your compensation if you win the case.if you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. it mig

23、ht be best to get advice from an experienced adviser, for example, at a citizens advice bureau. to find your nearest cab, including those that give advice by e-mail, click onnearest cab.for more information about making a claim to an employment tribunal, seeemployment tribunals.the (lack of) air up

24、there watch mcayman islands-based webb, the head of fifas anti-racism taskforce, is in london for the football associations 150th anniversary celebrations and will attend citys premier league match at chelsea on sunday.i am going to be at the match tomorrow and i have asked to meet yaya toure, he to

25、ld bbc sport.for me its about how he felt and i would like to speak to him first to find out what his experience was.uefa hasopened disciplinary proceedings against cskafor the racist behaviour of their fans duringcitys 2-1 win.michel platini, president of european footballs governing body, has also

26、 ordered an immediate investigation into the referees actions.cska said they were surprised and disappointed by toures complaint. in a statement the russian side added: we found no racist insults from fans of cska.age has reached the end of the beginning of a word. may be guilty in his seems to pass

27、ing a lot of different life became the appearance of the same day; may be back in the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. always feel oneself should go to do something, or write something. twenty years of life tr

28、ajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。the end of our life, and can meet many things really do?而穷尽我们的一生,又能遇到多少事情是真正地非做不可?during my c

29、hildhood, think lucky money and new clothes are necessary for new year, but as the advance of the age, will be more and more found that those things are optional; junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumn

30、i in peace, suddenly found that isnt really grow up, it seems is not so important; then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again

31、stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年时,觉得压岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同学录的时候,突然就发现是不是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐露出自己的心声才能为高中生涯里的懵懂情愫划上

32、一个句点,但毕业晚会的时候最终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起他的容颜。originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。a persons time, your ideas are always special to clear. want, want, line

33、is clear, as if nothing could shake his. also once seemed to be determined to do something, but more often is he backed out at last. dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. those who do, just green years oneself

34、 give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。at the moment, the sky is dark, the air is fresh factor after ju

35、st rained. suddenly thought of blue plaid shirt; those were broken into various shapes of stationery; from the corner at the beginning of deep friendship; have declared the end of the encounter that havent start planning. those years, those days of do, finally, like youth, will end in our life.此刻,天空

36、是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。baumgartner the disappointing news: mission aborted. r plays an important role in this mission. starting at the ground, conditions have to be very calm - winds less than 2 mph, with no p

37、recipitation or humidity and limited cloud cover. the balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. it will climb higher than the tip of mount everest (5.5 miles/8.85 kilometers), drifting even higher than th

38、e cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. as he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.the supersonic descent could happen as early as sunda.the weathethe balloon will slowly drift to the edge of space at 120,000 feet ( then, i would assume, he will slowly step out onto something resembling an ol

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论