




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、1.設(shè)計背景汽車計價器是乘客與司機雙方的交易準則,它是出租車行業(yè)發(fā)展的重要標志,是出租車最重要的工具。它關(guān)系著雙方的利益。具有良好的性能的計價器無疑是對廣大出租車司機朋友還是乘客來說都是很重要的。因此,汽車計價器的研究也是十分有應(yīng)用價值的。隨著生活水平的提高,人們已不再滿足于衣食住的享受,出行的舒適已受到越來越多人的關(guān)注。于是,出租車行業(yè)以低價高質(zhì)的服務(wù)給人們帶來了出行的享受。但是總存在著買賣糾紛困擾著行業(yè)的發(fā)展。而在出租車行業(yè)中解決這一矛盾的最好方法就是改良計價器。用更加精良的計價器來為乘客提供更加方便快捷的服務(wù)。我國在70年代開始出現(xiàn)出租車,但那時的計費系統(tǒng)大都是國外進口的,不但不不夠準確
2、,而且價格還十分昂貴。隨著改革開放的日益深入,出租車行業(yè)的發(fā)展勢頭已十分突出,國內(nèi)各機械廠紛紛推出國產(chǎn)計價器。剛開始出租車計價器的功能從剛才開始的只顯示路程,到能夠自主計費,以及現(xiàn)在能夠打印發(fā)票和語音提示、按時間自主變動單價等功能。隨著旅游業(yè)的發(fā)展,出租車行業(yè)已成為城市的窗口,象征著一個城市的文明程度。本設(shè)計就是采用VHDL硬件描述語言作為設(shè)計手段,采用自頂向下的設(shè)計思路,得到出租車計價系統(tǒng)的硬件結(jié)構(gòu),通過Quartus II 7.2軟件下進行設(shè)計、仿真,再在EDA試驗箱進行硬件仿真,使各項指標符合設(shè)計要求,具有一定的實用性。雖然以前有基于數(shù)字電路、單片機進行的出租車計價器的設(shè)計,但用數(shù)字電路
3、設(shè)計的整體電路規(guī)模較大,所用的器件較多,造成故障率高,導(dǎo)致計價器不夠準確;而基于單片機的設(shè)計,雖然開發(fā)成本降低,但其外圍電路較多,而且調(diào)試復(fù)雜,抗干擾能力差,從而也導(dǎo)致計價器不夠準確。而基于VHDL語言的FPGA芯片穩(wěn)定性好,抗干擾能力強,外圍電路少,執(zhí)行速度快,適合像出租車計價器的這種較復(fù)雜的電路設(shè)計。2.設(shè)計原理2.1 設(shè)計要求設(shè)計一種出租車計價器,計費標準如下:(1) 起步價8.00元,起步公里為3公里;(2) 超過三公里,每公里按1.00元收費;(3) 單程行駛里程超過20公里。每公里租價加收50%;(4) 等候時間累積一分鐘,每分鐘1.00元;要求顯示里程、計費及等候時間。乘客上車后
4、,按下啟動鍵,開始計費,除非同一個乘客往返用哪個車,否則按下單程鍵,這樣行駛里程超過20公里時,每公里加收50%,即每公里租費1.5元;計費顯示為3位整數(shù),一位小數(shù)。2.2 設(shè)計模塊2.2.1 總體設(shè)計本出租車計價器的設(shè)計共分4個模塊:判斷模塊、時間模塊、里程模塊、計費模塊??偟脑O(shè)計圖如圖1所示:單雙程控制判斷模塊里程模塊計費模塊時間輸出計費輸出里程輸出秒脈沖輸入里程脈沖輸入計價開始控制圖1.總體設(shè)計圖時間模塊2.2.2 判斷模塊判斷模塊主要通過對秒脈沖和里程脈沖進行計數(shù),判斷出租車是否停下,然后輸出片選信號,選擇時間計費還是里程計費。判斷模塊的模塊圖如圖2所示:判斷模塊stasclklclk
5、dge圖2.判斷模塊2.2.3 時間模塊時間模塊是當(dāng)出租車停下時,對秒脈沖進行計數(shù),從而計算出出租車停下的累積時間,并輸出累積時間和計費脈沖。時間模塊的模塊圖如圖3所示:時間模塊stasclkdget_count圖3.時間模塊時間輸出2.2.4 里程模塊里程模塊是當(dāng)出租車行駛的時候,對里程脈沖進行計數(shù),從而算出出租車所行駛的里程,通過對單雙程的控制進行不同的計費標準,最后輸出行駛里程和計費脈沖。里程模塊的模塊圖如圖4所示:里程模塊stalclkdged_count圖4.里程模塊里程輸出doub2.2.5 計費模塊計費模塊stat_countd_count圖5.計費模塊計費輸出計費模塊通過對里程
6、計費脈沖和時間計費脈沖分別進行計數(shù),將其換算成價錢并對進行價錢輸出。計費模塊的模塊圖如圖5所示:3. 仿真結(jié)果分析3.1 判斷模塊的仿真判斷模塊的仿真結(jié)果如圖6所示:圖6 判斷模塊的仿真結(jié)果3.2 時間模塊的仿真時間模塊的仿真結(jié)果如圖7所示:圖7 時間模塊的仿真結(jié)果3.3 里程模塊的仿真里程模塊的仿真結(jié)果如圖8所示:圖8 里程模塊的仿真結(jié)果3.4 計費模塊的仿真計費模塊的仿真結(jié)果如圖9所示:圖9 計費模塊的仿真結(jié)果 3.5元件例化后的仿真元件例化后的仿真結(jié)果如圖10所示:圖10 元件例化后的仿真結(jié)果6.模塊的引腳鎖定圖11 模塊的引腳鎖定引腳鎖定圖如圖11所示:4. 設(shè)計總結(jié)在這次對出租車計價
7、器的課程設(shè)計實習(xí)中,我們充分的應(yīng)用了所學(xué)的知識,通過去圖書館查閱相關(guān)資料和上網(wǎng)搜索相關(guān)知識,我們頗有收獲。由于這次設(shè)計比往常設(shè)計要復(fù)雜,如果將所有功能設(shè)計到一個模塊中,對于設(shè)計和編程都有不小的困難,所以最后我們采用模塊化設(shè)計,將某些功能設(shè)計成一個模塊,最后用元件例化將各個模塊連接起來,形成一個完整的系統(tǒng),這種設(shè)計方法不僅降低了編程難度,而且使我們的設(shè)計更有條理。通過這次設(shè)計,我們對模塊化設(shè)計有了更深的了解。在這次設(shè)計中,我們也遇到了許多困難。有些設(shè)計雖然在邏輯上成立,但FPGA的硬件結(jié)構(gòu)不能實現(xiàn)這種設(shè)計,比如多值驅(qū)動問題,上升下降沿問題,像我在設(shè)計計費模塊的時候,預(yù)想的是時間計費脈沖和里程計費
8、脈沖共同來驅(qū)動計費計數(shù)器,實現(xiàn)計費功能,這種設(shè)計很簡單,但這種設(shè)計會報錯。最后只能時間、里程分別計費,然后將費用分別相加,這種設(shè)計雖然有點復(fù)雜,但并沒有報錯,而且仿真結(jié)果正確。通過這次設(shè)計我們更加了解了FPGA的硬件結(jié)構(gòu),以后設(shè)計的時候要注意使用能實現(xiàn)的設(shè)計方式。這次設(shè)計讓我們更加了解了EDA的設(shè)計方法,熟悉了模塊化的設(shè)計思路,對于以后的設(shè)計很有幫助??傊@次設(shè)計很有意義。參考文獻1 潘松,黃繼業(yè). EDA技術(shù)使用教程. 科學(xué)出版社,2010.62 劉江海. EDA技術(shù)課程設(shè)計. 華中科技大學(xué)出版社,2009.5附錄參考程序:1.判斷模塊library ieee;use ieee.std_l
9、ogic_1164.all;-entity judge isport(sclk,sta,lclk: in std_logic; dge: out std_logic);end;architecture beh of judge isbeginprocess(sta,lclk,sclk)variable a: integer range 0 to 64;beginif sta='1' then if lclk'event and lclk='1' then a:=a+1; end if; if sclk'event and sclk='1&
10、#39; then if a=0 then dge<='0'-shijian process else dge<='1'-licheng process end if; end if; if sclk='1' then a:=0; end if;else dge<='Z'end if;end process;end;2.時間模塊library ieee;use ieee.std_logic_1164.all;-entity time_count isport(sta,sclk,dge: in std_logic;
11、 t_count: out std_logic; minge: out integer range 0 to 10; minshi: out integer range 0 to 10);end;-architecture beh of time_count isbeginprocess(sta,sclk,dge)variable count: integer range 0 to 60;variable ge: integer range 0 to 10;variable shi: integer range 0 to 10;variable t_c: std_logic;beginif s
12、ta='1' thenif dge='0' then if sclk'event and sclk='1' then count:=count+1; if count=1 then t_c:='0' end if; if count=60 then count:=0; ge:=ge+1; t_c:='1' if ge=10 then ge:=0; shi:=shi+1; if shi=10 then shi:=0; end if; end if; end if; end if;end if;else ge:
13、=0; shi:=0; t_c:='0'end if;minge<=ge;minshi<=shi;t_count<=t_c;end process;end;3.里程模塊-1500round/km-1.00yuan/km-> per150->+1-1.50yuan/km-> per100->+1library ieee;use ieee.std_logic_1164.all;-entity distance_count isport( sta,lclk,doub,dge: in std_logic; kmfen,kmge,kmshi: o
14、ut integer range 0 to 10; d_count: out std_logic);end;-architecture beh of distance_count isbeginprocess(sta,lclk,doub,dge)variable fen,ge,shi: integer range 0 to 10;variable count: integer range 0 to 150;variable ct: integer range 0 to 150;variable d_c: std_logic;beginif sta='1' thenif dge=
15、'1' then if lclk'event and lclk='1' then ct:=ct+1; count:=count+1; if doub='0' and shi>=2 then -single and licheng>=20km if ct=1 then d_c:='0' end if; if ct=100 then ct:=0; d_c:='1' end if; elsif ge>=3 or shi/=0 then -double or licheng<=20km an
16、d km>3 if ct=1 then d_c:='0' end if; if ct=150 then ct:=0; d_c:='1' end if; else ct:=0; end if; if count=150 then count:=0; fen:=fen+1; if fen=10 then fen:=0; ge:=ge+1; if ge=10 then ge:=0; shi:=shi+1; if shi=10 then shi:=0; end if; end if; end if; end if; end if;end if; else fen:
17、=0; ge:=0; shi:=0; d_c:='0'end if; kmfen<=fen;kmge<=ge;kmshi<=shi;d_count<=d_c;end process;end;4.計費模塊library ieee;use ieee.std_logic_1164.all;-entity price_count isport(sta,t_count,d_count: in std_logic; mjiao,mge,mshi,mbai: out integer range 0 to 10);end;-architecture beh of pri
18、ce_count issignal t_ge,t_shi,t_bai: integer range 0 to 10;signal d_ge,d_shi,d_bai: integer range 0 to 10;begin-process(sta,t_count)variable tshi,tbai: integer range 0 to 10;variable tge: integer range 0 to 10:=8;beginif sta='1' then if t_count'event and t_count='1' then tge:=tge+
19、1; if tge=10 then tge:=0; tshi:=tshi+1; if tshi=10 then tshi:=0; tbai:=tbai+1; if tbai=10 then tbai:=0; end if; end if; end if; end if;else tge:=8; tshi:=0; tbai:=0;end if;t_ge<=tge;t_shi<=tshi;t_bai<=tbai;end process;-process(sta,d_count)variable djiao: integer range 0 to 10;variable dge,d
20、shi,dbai: integer range 0 to 10;beginif sta='1' then if d_count'event and d_count='1' then djiao:=djiao+1; if djiao=10 then djiao:=0; dge:=dge+1; if dge=10 then dge:=0; dshi:=dshi+1; if dshi=10 then dshi:=0; dbai:=dbai+1; if dbai=10 then dbai:=0; end if; end if; end if; end if; e
21、nd if;else djiao:=0; dge:=0; dshi:=0; dbai:=0;end if;mjiao<=djiao;d_ge<=dge;d_shi<=dshi;d_bai<=dbai;end process;-process(d_ge,d_shi,d_bai,t_ge,t_shi,t_bai)variable cge,cshi,cbai: integer range 0 to 1;variable ge,shi,bai:integer range 0 to 20;begin ge:=d_ge+t_ge; if ge>=10 then ge:=ge-
22、10; cge:=1; else cge:=0; end if; shi:=d_shi+t_shi+cge; if shi>=10 then shi:=shi-10; cshi:=1; else cshi:=0; end if; bai:=d_bai+t_bai+cshi; if bai>=10 then bai:=bai-10; cbai:=1; else cbai:=0; end if;mge<=ge;mshi<=shi;mbai<=bai;end process;end;5.元件例化library ieee;use ieee.std_logic_1164.a
23、ll;-entity comp is port(sclk,lclk,sta,doub: in std_logic; time_ge,time_shi: out integer range 0 to 10; pri_jiao,pri_ge,pri_shi,pri_bai: out integer range 0 to 10; dis_fen,dis_ge,dis_shi: out integer range 0 to 10);end;-architecture beh of comp is-component judge isport(sclk,sta,lclk: in std_logic; dge: out std_logic);end component;-component time_count isport(sta,sclk,dge: in std_logic; t_count: out std_logic; minge: out integer range 0 to 10; minshi: out integer range 0 to 10);end
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 健身器材用戶參與度提升策略實踐考核試卷
- 塑料鞋生產(chǎn)效率統(tǒng)計與分析考核試卷
- 數(shù)學(xué)空間想象力培養(yǎng)教具考核試卷
- 供應(yīng)鏈大數(shù)據(jù)分析在供應(yīng)鏈中的應(yīng)用案例解析考核試卷
- 北京車牌借用合同范本
- 蔬菜購銷合同范本
- 藥店店員培訓(xùn)課件
- 冷庫設(shè)備銷售合同范本
- 靜脈輸液的基本操作流程
- 數(shù)據(jù)傳輸網(wǎng)絡(luò)安全合作協(xié)議之?dāng)?shù)據(jù)傳輸保護服務(wù)合同
- 宮頸癌化療患者的護理
- 車間主任考核表實用文檔
- 提高領(lǐng)導(dǎo)干部的溝通能力
- 《航空公司服務(wù)質(zhì)量改善研究8800字(論文)》
- GB/T 9124-2010鋼制管法蘭技術(shù)條件
- GB/T 4117-2008工業(yè)用二氯甲烷
- FZ/T 07019-2021針織印染面料單位產(chǎn)品能源消耗限額
- 人教PEP版英語五年級下冊第四單元全部課件
- 硬筆書法 社團教案
- 中國膿毒癥及膿毒性休克急診治療指南
- 工序標準工時及產(chǎn)能計算表
評論
0/150
提交評論