單片機(jī)硬件實(shí)習(xí)報(bào)告——模擬電梯設(shè)計(jì)_第1頁(yè)
單片機(jī)硬件實(shí)習(xí)報(bào)告——模擬電梯設(shè)計(jì)_第2頁(yè)
單片機(jī)硬件實(shí)習(xí)報(bào)告——模擬電梯設(shè)計(jì)_第3頁(yè)
單片機(jī)硬件實(shí)習(xí)報(bào)告——模擬電梯設(shè)計(jì)_第4頁(yè)
單片機(jī)硬件實(shí)習(xí)報(bào)告——模擬電梯設(shè)計(jì)_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 單片機(jī)硬件實(shí)習(xí)報(bào)告題 目 : 模 擬 電 梯 設(shè) 計(jì) 學(xué)生姓名: 學(xué)號(hào): 學(xué)院(系: 專業(yè)班級(jí): 指導(dǎo)教師: 實(shí)習(xí)時(shí)間: 2011 年 2 月 21 日 2010 年 3 月 4 日目 錄1.前言11.1設(shè)計(jì)背景11.2設(shè)計(jì)內(nèi)容11.3硬件實(shí)習(xí)的目的12.硬件電路描述及設(shè)計(jì)12.1 電路連線及概述12.2 8255掃描鍵盤及與led接口電路圖23.軟件電路描述及設(shè)計(jì)33.1軟件設(shè)計(jì)流程圖34.源程序代碼45.設(shè)計(jì)心得10參考文獻(xiàn)101.前言1.1設(shè)計(jì)背景電梯作為現(xiàn)代高層建筑最常用的垂直運(yùn)輸工具,廣泛應(yīng)用于社會(huì)活動(dòng)的各個(gè)角落,如何保證每臺(tái)電梯都能夠可靠運(yùn)行,已成為提高物業(yè)管理水平和電梯技術(shù)進(jìn)步

2、的關(guān)鍵所在。電梯運(yùn)行質(zhì)量直接由控制系統(tǒng)的功能決定,而控制系統(tǒng)軟件又直接決定著控制系統(tǒng)運(yùn)行的好壞。上位機(jī)監(jiān)控對(duì)電梯安全運(yùn)行和故障維修具有重要意義,在減少維修管理人員的同時(shí),可及時(shí)發(fā)現(xiàn)故障,縮短故障候梯時(shí)間,實(shí)現(xiàn)管理的自動(dòng)化。面向?qū)ο蟮某绦蛟O(shè)計(jì)更適合對(duì)現(xiàn)實(shí)生活中的描述,更加體現(xiàn)了軟件的工業(yè)化的精神。1.2設(shè)計(jì)內(nèi)容本文根據(jù)實(shí)驗(yàn)室提供的單片機(jī)實(shí)驗(yàn)箱,利用鍵盤、開關(guān)、數(shù)碼管和 led模擬實(shí)現(xiàn)八層電梯的控制。并且設(shè)計(jì)急停開關(guān)和斷電維修開關(guān)以模擬實(shí)物電梯的更多的運(yùn)行功能。軟件利用c語(yǔ)言,通過(guò)檢測(cè)用戶請(qǐng)求的按鍵信息,根據(jù)電梯運(yùn)行到相應(yīng)樓層送到單片機(jī)計(jì)數(shù)來(lái)確定樓層數(shù),并送到數(shù)碼管進(jìn)行顯示。硬件設(shè)計(jì)簡(jiǎn)單可靠,結(jié)合

3、軟件,基本實(shí)現(xiàn)了八層電梯運(yùn)行的模擬。1.3硬件實(shí)習(xí)的目的(1)利用所學(xué)過(guò)的知識(shí),初步分析單片機(jī)原理及接口技術(shù)的能力;(2)進(jìn)一步掌握硬件電路和軟件功能的設(shè)計(jì)方法;(3)了解8255可編程并行接口芯片的工作原理,掌握8255的各種模式編程方法;(4)實(shí)驗(yàn)結(jié)果調(diào)試分析、總結(jié)及撰寫技術(shù)報(bào)告的能力。2.硬件電路設(shè)計(jì)及描述2.1 電路連線及概述p1.0-p1.7接l0-l7八個(gè)發(fā)光二極管2.2 8255掃描鍵盤與led接口電路圖3.軟件設(shè)計(jì)流程及描述 3.1軟件設(shè)計(jì)流程圖4.源程序代碼#include#include/*the address of 8255*/#define c8255 xbyte0x

4、f22b /8255command#define p8255a xbyte0xf228#define p8255b xbyte0xf229#define p8255c xbyte0xf22a#define p8255 xbyte0xf22a/* three tables */unsigned char code table= /segment value for led0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f;unsigned char code table1=/0x7f-light p10 .0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0

5、xfd,0xfe;unsigned char code table2= /p1=table1elevator.currentlevel|table2elevator.currentlevel0x80,0x40,0x20,0x10, /-extinguish the led on current floor0x08,0x04,0x02,0x01;void init();void keyscan();void currentshow(unsigned char); void delay();/2svoid delayms();/20msunsigned int move;unsigned int

6、currentfloor;unsigned int direction;unsigned int destination9;char times=0; unsigned int repairs; /0-do not repair; 1-repairing/* */ void main()unsigned char i,j;init(); /*init the elevator*/currentshow(currentfloor);while(1)while(repairs=250) / repairs=250 need to repairrepairs=p33;move=p31;keyscan

7、();while(move=254&destination0!=0) /moving key was pressed while(repairs=250) / repairs0;j-) /weather there are destinations downstairsif(destinationj=0x1)break; if(jbit orbreak;case 1: /risingif(currentfloor=8) /weather there are destinations upstairsmove=0;direction=2;else for(j=currentfloor+1;j8)

8、direction=2;elseif(destinationcurrentfloor+1!=0)/ move=0;destination0-;direction=0;destinationcurrentfloor+1=0;p1|=table2currentfloor;/extinguish the corresponding led/ |-bit orcurrentshow(currentfloor);currentfloor+;break;default: /stationaryfor(i=1;i9;i+) /decide up or downif(destinationi!=0)break

9、; if(icurrentfloor)/should updirection=1;elsemove=0;destination0-;direction=0;destinationcurrentfloor=0;/the destination is current level, /do nothing but extiguish the ledp1|=table2currentfloor-1;delay(); /2s/levelvoid init() /timer,elevator unsigned char i;/*timer and external interrupt init*/tmod

10、=0x01;th0=(65536-45872)/256;/50mstl0=(65536-45872)%256;ea=1;et0=1;ex0=1;ex1=1;it1=1;/*elevator init*/move=0;/*0-the elevator now will not move,commands comes from p30*/for(i=0;ilight the corresponding ledcase 0xfd:key=1;p1&=table1key;break;case 0xfb:key=2;p1&=table1key;break;case 0xf7:key=3;p1&=tabl

11、e1key;break;case 0xef:key=4;p1&=table1key;break;case 0xdf:key=5;p1&=table1key;break;case 0xbf:key=6;p1&=table1key;break;case 0x7f:key=7;p1&=table1key;break;destinationkey+1=1; /set the corresponding level destination0+; /total number of destination temp=p8255b; while(temp!=0xff) temp=p8255b;void cur

12、rentshow(unsigned char num)p8255c=0x0; /wei xuanp8255a=tablenum;void delayms()unsigned int i,j;/delay for 20msfor(i=20;i0;i-)for(j=110;j0;j-);void delay()tr0=1;while(times!=40)times=0;tr0=0;void t0_timer() interrupt 1th0=(65536-45872)/256;/50mstl0=(65536-45872)%256;times+;void extern0() interrupt 0

13、/wait to repairex1=0;if(repairs=0)repairs=1;elserepairs=0;ex1=1;void extern1() interrupt 3 /emergencydirection=0; /stop the elevatormove=0;5.設(shè)計(jì)心得本次實(shí)習(xí)我們選擇了模擬日常生活中常見的電梯運(yùn)行過(guò)程。這次實(shí)習(xí)讓我對(duì)程序的設(shè)計(jì)、調(diào)試有了更深刻的認(rèn)識(shí)。尤其是寫單片機(jī)這類的與硬件相關(guān)的程序。在調(diào)試的時(shí)候會(huì)有不少意想不到的結(jié)果。這要求除了對(duì)程序充分了解,還要對(duì)硬件的特性,電路的連接也深刻認(rèn)識(shí)。關(guān)于程序,總結(jié)如下:必須養(yǎng)成在寫之前仔細(xì)分析需求、要求,畫出流程圖,先明確各個(gè)模塊的作用。最后分塊細(xì)化,從底向上設(shè)計(jì)的習(xí)慣。否則很容易出現(xiàn)程序?qū)懥艘话氚l(fā)現(xiàn)理解出錯(cuò),功能達(dá)不到的情況。還有程序注釋必須及時(shí),不能等到寫完了再注釋,否則可能之后連自己也看不懂程序。及時(shí)的修改記錄也是必要的。對(duì)于硬件、電路:要熟練掌握如何用c、匯編語(yǔ)言操作芯片。要掌握常用芯片的用法、特性,至少要熟悉其datasheet,需要使用時(shí)通過(guò)查閱手冊(cè),能快速、熟練的使用該芯

溫馨提示

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

評(píng)論

0/150

提交評(píng)論