畢業(yè)設計基于STC89C52單片機的窗簾設計_第1頁
畢業(yè)設計基于STC89C52單片機的窗簾設計_第2頁
畢業(yè)設計基于STC89C52單片機的窗簾設計_第3頁
畢業(yè)設計基于STC89C52單片機的窗簾設計_第4頁
畢業(yè)設計基于STC89C52單片機的窗簾設計_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、河南理工大學微機原理與單片機接口技術(shù)課程設計報告題目: 基于單片機的遙控窗簾設計 姓 名: 學 號: 專業(yè)班級: 指導老師: 所在學院: 電氣工程與自動化學院 2013年4月5日摘 要 本實驗裝置是以單片機stc89c52為控制核心的遙控窗簾,通過鍵盤控制和無線遠程遙控實現(xiàn)遙控窗簾不同的工作模式以及對窗簾的位置,通過霍爾傳感器反饋信號控制。遙控窗簾的不同模式通過三種不同顏色的發(fā)光二極管進行顯示。每次進行模式切換時能實現(xiàn)窗簾的拉開與拉住,窗簾的開合是用一個由l298n驅(qū)動芯片驅(qū)動的5v的直流電機的正反轉(zhuǎn)帶動實現(xiàn)的。此電子設計,總體來說,從功能上來說較為簡單,從成本上來說造價低,經(jīng)濟實用,利于推廣

2、,能夠滿足智能家居要求。關鍵字:stc89c52 單片機 霍爾傳感器 l298n 直流電機 無線控制模塊目 錄 第一章 概述31.1 引言31.2基本要求3第二章 基本硬件系統(tǒng)的設計與功能實現(xiàn)42.1 stc89c52單片機簡介42.2 l298電機驅(qū)動芯片42.3無線電遙控接收模塊62.4防過卷模塊6第三章 軟件設計93.1 流程圖93.2 總程序9第四章 proteus仿真104.1仿真圖104.2仿真圖說明10第五章 課程設計體會11參考文獻:12附1:源程序代碼13附2:系統(tǒng)原理圖17第一章 概述1.1 引言隨著國民經(jīng)濟的發(fā)展和科學技術(shù)水平的提高,特別是計算機技術(shù),通信技術(shù),網(wǎng)絡技術(shù),

3、控制技術(shù)的迅猛發(fā)展,生活現(xiàn)代化得以實現(xiàn),居住環(huán)境向舒適化,安全化發(fā)展,家居智能化在這種形式下應運而生。因此,我們組經(jīng)過共同的討論和深入考慮決定做遙控窗簾。我們的作品采用了stc89c52單片機進行了簡單的設計,并通過驅(qū)動放大電路驅(qū)動電機,中間還設有控制不同模式遙控窗簾開關控制電路。1.2基本要求1.利用直流電機正反轉(zhuǎn)實現(xiàn)控制窗簾的開關。2. 防過卷功能。3. 具有無線遙控和手動按鍵控制兩種功能。4. 能夠指示運行狀態(tài)。第二章 基本硬件系統(tǒng)的設計與功能實現(xiàn)本系統(tǒng)采用stc89c52單片機作為主控制核心部件,主要通過按鍵和遠程控制信號來實現(xiàn)電機的驅(qū)動的控制信號。以下是基于單片機的遙控窗簾設計的各部

4、分介紹:2.1 stc89c52單片機簡介stc89c52單片機是一種低功耗、高性能cmos8位微控制器,具有8k 在系統(tǒng)可編程flash 存儲器。使用atmel 公司高密度非易失性存儲器技術(shù)制造,與工業(yè)80c51 產(chǎn)品指令和引腳完全兼容。片上flash允許程序存儲器在系統(tǒng)可編程,亦適于常規(guī)編程器。在單芯片上,擁有靈巧的8 位cpu 和在系統(tǒng)可編程flash,使得stc89c52單片機在眾多嵌入式控制應用系統(tǒng)中得到廣泛應用。2.2 l298電機驅(qū)動芯片l298可直接的對電機進行控制,無需隔離電路。通過單片機的i/o輸入改變芯片的控制端的電平,即可以對電機進行正反轉(zhuǎn),停止的操作,非常方便,亦能滿

5、足直流減速及輸出大電流要求。表 1 是 l298n 功能邏輯圖:ena(b)in1(in3)in2(in4)電機運行狀況hhl正轉(zhuǎn)hlh反轉(zhuǎn)h同in2(in4)同in1(in3)快速停止lxx停止表1 l298n邏輯功能表下圖是其引腳圖:圖1l298n圖2l298n控制電機1和15和8引腳直接接地。4管腳vs接2.5到46的電壓,它是用來驅(qū)動電機的。9引腳是用來接4.5到7v的電壓的,它是用來驅(qū)動l298芯片的。6和11引腳是使能端,一個使能端控制一個電機工作。5,7,10,12是298的信號輸入端和單片機的io口相連。2,3,13,14是輸出端。輸入5和7控制輸出2和3, 輸入的10,12控

6、制輸出的13,14。在我們的課程設計中,只用到了一個電機,用5、7管腳控制2、3管腳的輸出來控制電機的正反轉(zhuǎn)以及調(diào)速功能。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連接檢測無線信號,通過相應的無線電遙控信號來控制系統(tǒng)的狀態(tài)。2.4防過卷模塊這個窗簾是通過電機帶動從左往右打開,所以這里設計兩

7、個霍爾傳感器,一個設計在窗簾導軌的最左邊,用于檢測窗簾是否已完全關閉;另一個設計在窗簾的最右邊,用于檢測窗簾是否已完全打開,從而防止由于電機長時間通電而損壞。本裝置用到的霍爾傳感器的介紹:霍爾傳感器是一種磁傳感器。用它可以檢測磁場及其變化,可在各種與磁場有關的場合中使用。由于霍爾元件產(chǎn)生的電勢差很小,故通常將霍爾元件與放大器電路、溫度補償電路及穩(wěn)壓電源電路等集成在一個芯片上,稱之為霍爾傳感器。如圖2所示圖 3霍爾傳感器霍爾傳感器分為線性型霍爾傳感器和開關型霍爾傳感器兩種。我們用到的是開關型霍爾傳感器,由穩(wěn)壓器、霍爾元件、差分放大器,斯密特觸發(fā)器和輸出級組成,它輸出數(shù)字量。本次所采用的是閉鎖性的

8、霍爾傳感器,其特性如圖5所示。當磁感應強度超過動作點bop時,傳感器輸出由高電平躍變?yōu)榈碗娖?,而在外磁場撤消后,其輸出狀態(tài)保持不變(即鎖存狀態(tài)),必須施加反向磁感應強度達到brp時,才能使電平產(chǎn)生變化。圖4閉鎖性特性所以,通過將霍爾傳感器至于窗簾的最左端和最右端,使得當窗簾打開到最右,閉合到最左時,能夠自動發(fā)送信號關閉電機。防過卷電路如下 圖5防卷電路圖如圖所示,對應的端口分別接對應的地與+5v。當有磁鐵靠近時,輸出為高電平。當窗簾拉開時,達到指定的位置時,對應的輸出為高電平,電機停轉(zhuǎn)。當窗簾關閉時,到達指定的位置時,對應的輸出為高電平,電機停轉(zhuǎn)。第三章 軟件設計延遲 是否有按鍵按下鍵盤掃描開

9、始nync按下檢測哪個鍵按下ya按下反轉(zhuǎn)b按下正轉(zhuǎn)停止3.1 流程圖3.2 總程序總程序見附1第四章 proteus仿真4.1仿真圖4.2仿真圖說明該系統(tǒng)主要有按鍵控制模塊,發(fā)光二極管指示模塊,cpu控制模塊,l298驅(qū)動電機模塊。三個按鍵分別接單片機p0.5、p0.6 、p0.7,分別控制電機正轉(zhuǎn)、反轉(zhuǎn)、停機三種工作狀態(tài)。綠黃紅三個發(fā)光二極管分別指示窗簾的正轉(zhuǎn)與反轉(zhuǎn)以及停止。l298是驅(qū)動電機的部分,由單片機引出p2.0、p2.1、 p2.2控制驅(qū)動的輸入端和使能端in1、in2、ena,驅(qū)動的輸出端out1、out2則連到電機兩端。工作時,當按下按鍵1,經(jīng)過p2.0,p1.1分別輸出高低電

10、平,然后由驅(qū)動輸出out1,out2管腳的高低電平,電機正轉(zhuǎn),綠燈亮;當按下按鍵2,電機反轉(zhuǎn),黃燈亮。當按下按鍵3時,讓電機停轉(zhuǎn)。第五章 課程設計體會這次課程設計是對上學期微機原理與單片機接口技術(shù)課程的鞏固,雖然為期比較長,但是還是有許多設計不夠完美,在硬件設計上考慮不周全,雖然基本功能可以實現(xiàn),但設計不太實用,需要改進。在拿到課程設計題目之后,選定這個題目主要是主觀認為該題目比較有趣,有挑戰(zhàn)性,與其他幾個相比,有發(fā)散思維,提高動手能力的效果。懷著比較期待以及興奮的心情,在寒假里,我們組內(nèi)兩人都開始著手準備,搜集相關資料,主要是根據(jù)要實現(xiàn)的功能確立怎么實現(xiàn)相應功能的方案,在此基礎上,通過看前輩

11、們的設計,查閱相關芯片的功能原理,引腳以及接線,搞清每一塊的具體如何接線,如何實現(xiàn)。而其中主要就是無線控制模塊的接入,l289驅(qū)動控制模塊的連接以及工作原理,較難的就是霍爾傳感器防過卷控制模塊的設計。由于我們利用的是上學期做好的單片機控制板,按鍵,指示燈等都已經(jīng)設計好,所以只需要通過軟件控制寫程序?qū)崿F(xiàn)手動按鍵控制和顯示功能,這為我們的設計省去了很多麻煩。而電機正反轉(zhuǎn)以及無線控制相對也比較簡單,只要了解了相應硬件功能,很容易實現(xiàn)。另外,寫程序相對于上學期我們做過的四個實驗的復雜程度,這個算是相當簡單。最復雜以及耗費時間的就是硬件構(gòu)架設計,本以為很簡單,結(jié)果在實現(xiàn)正反轉(zhuǎn)的設計上遇到了很大麻煩,最后

12、的設計算是差強人意。防過卷模塊的安裝也比較麻煩。雖然做這個設計花費了很長時間和精力,但是同時我們也有很多收獲,任何看似簡單的事情,如果認真去做,都會有很多可探尋的技巧,做實驗需要耐心細心用心,切不可眼高手低,心浮氣躁。通過這個實驗,讓我認識到單片機功能的強大,基于單片機,我們可以通過接各種各樣的外設,實現(xiàn)各種不同功能,有待我們?nèi)ヌ剿鳌?參考文獻:1 楊凌霄,王麗微機原理與單片機接口技術(shù)中國電力出版社,2012,231-3762 郭天祥51單片機c語言教程中國電子工業(yè)出版社,2009-01-013 邱關源,羅先覺電路高等教育出版社,2006-03-01,115-1204 百度文庫l298中文資料

13、, 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 w2=p11;sbit w3=p1

14、2;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)/正轉(zhuǎn) 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=1|i=1) break; if

15、(k2=0)/反轉(zhuǎn) 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) /正轉(zhuǎn) g=0;y=1;r=1; ena=1;in1=1;in2=0; delay(10); ena=1;in1=0;in2=0; delay(20); if(k1=0|k2=0|k

16、3=0|h=1) break; while(w2=1) /反轉(zhuǎn) 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:系統(tǒng)原理圖employment tribunals sort out disagreements between employers and employees.you may need to make a claim to an e

17、mployment 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.you can make a claim to an employment tribuna

18、l, 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 must make an application to an employment tri

19、bunal 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 from one of the organisations listed underfurt

20、her 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 thinking about making a claim to an employment tribu

21、nal, 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 the case. this is known as adamages-based agree

22、ment. 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 might be best to get advice from an experienced

23、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 there watch mcayman islands-based webb, the h

24、ead 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 told bbc sport.for me its about how he felt and

25、 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 ordered an immediate investigation into the

26、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 passing a lot of different life became the appear

27、ance 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 trajectory deeply shallow, suddenly feel someth

28、ing, do it.一字開頭的年齡已經(jīng)到了尾聲?;蛟S是愧疚于自己似乎把轉(zhuǎn)瞬即逝的很多個不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏??傆X得自己自己似乎應該去做點什么,或者寫點什么。二十年的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。the end of our life, and can meet many things really do?而窮盡我們的一生,又能遇到多少事情是真正地非做不可?during my childhood, think lucky money and new clothes a

29、re 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 alumni in peace, suddenly found that isnt really g

30、row 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 stood on the pitch he has sweat profusely, lo

31、oked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年時,覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進,會越來越發(fā)現(xiàn),那些東西根本就可有可無;初中時,以為要有一場暗戀才意味著真正的成長,但三年過去后,自己心平氣和的寫同學錄的時候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個句點,但畢業(yè)晚會的時候最終還是被梗塞在了咽喉,后來再次站在他曾經(jīng)揮汗如雨的球場,看著他

32、投過籃球的球框時,突然間發(fā)現(xiàn)自己已經(jīng)想不起他的容顏。originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原來,這個世界上,對某個事件能產(chǎn)生化學反應的,除了非做不可的堅決,還有,時間。a persons time, your ideas are always special to clear. want, want, line is clear, as if nothing could shake his. also

33、 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 give oneself an arm injection, or is a self-

34、righteous spiritual.一個人的時候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒有什么可以撼動自己。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。嫌惡過自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯過,好像冥冥之中真的已經(jīng)注定。那些曾經(jīng)所謂的非做不可,只是青蔥年華里自己給自己注射的一支強心劑,或者說,是自以為是的精神寄托罷了。at the moment, the sky is dark, the air is fresh factor after just rained. suddenly thought of blue plaid shi

35、rt; 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、的信紙;那段從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結(jié)的邂逅計劃那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。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 precipitation or humidity and limited cloud co

37、ver. 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 the cruising altitude of commercial airliners (

38、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 olympi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論