出租車設(shè)計(jì)報(bào)告(共19頁)_第1頁
出租車設(shè)計(jì)報(bào)告(共19頁)_第2頁
出租車設(shè)計(jì)報(bào)告(共19頁)_第3頁
出租車設(shè)計(jì)報(bào)告(共19頁)_第4頁
出租車設(shè)計(jì)報(bào)告(共19頁)_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上 設(shè)計(jì)名稱: 專業(yè)軟件應(yīng)用綜合設(shè)計(jì)報(bào)告 題 目: 基于FPGA的出租車計(jì)價(jià)設(shè)計(jì) 年 級(jí): 2013級(jí) 學(xué)生姓名: 學(xué) 號(hào): 26 專 業(yè): 電子信息工程 指導(dǎo)教師: 日期: 2015年 12 月 28 日專業(yè)軟件應(yīng)用綜合設(shè)計(jì)報(bào)告 專心-專注-專業(yè)摘要利用FPGA設(shè)計(jì)出滿足出租車不同計(jì)費(fèi)需求的計(jì)費(fèi)器,去滿足當(dāng)?shù)爻鲎廛嚨挠?jì)費(fèi)需求。在這里我們用QuartusII9.0軟件進(jìn)行仿真模擬實(shí)現(xiàn),所用的編程語言是VHDL File。這個(gè)課題在實(shí)現(xiàn)計(jì)費(fèi)功能的同時(shí),也解決了傳統(tǒng)出租車計(jì)費(fèi)器系統(tǒng)的不足。出租車的需求不斷的增大,因此,出租車計(jì)費(fèi)器的需求也將不斷增大,計(jì)程車的服務(wù)也顯得越來越

2、重要,因此出租車計(jì)費(fèi)器也就應(yīng)運(yùn)而生了。 關(guān)鍵詞FPGA;計(jì)費(fèi)器;Quartus9.0;VHDL File語言目錄 第1章 前言1.1發(fā)展概括與設(shè)計(jì)背景伴隨中國經(jīng)濟(jì)的騰飛,城市化的進(jìn)程也隨之加快。雖然人們出行的選擇趨于多樣化,但是出租車作為一種重要的交通工具,也為很多人作為出行的選擇。大城市里出租車已經(jīng)相當(dāng)普及,但是在中小城市出租車依然處于快速發(fā)展的階段。出租車的計(jì)費(fèi)方式也在發(fā)生變化,由只能顯示里程的方式變?yōu)楝F(xiàn)在的自主計(jì)費(fèi)和打印發(fā)票及語音提示的智能化方式;根據(jù)出租車行業(yè)的發(fā)展需求,國內(nèi)許多生產(chǎn)廠商也制造出不同類型的計(jì)價(jià)器,傳統(tǒng)的出租車計(jì)費(fèi)器經(jīng)過十幾年的使用,在穩(wěn)定性,成本等方面都具有一定的優(yōu)勢(shì)。

3、利用FPGA設(shè)計(jì)出滿足出租車不同計(jì)費(fèi)需求的計(jì)費(fèi)器,去滿足當(dāng)?shù)爻鲎廛嚨挠?jì)費(fèi)需求。這個(gè)課題在實(shí)現(xiàn)計(jì)費(fèi)功能的同時(shí),也解決了傳統(tǒng)出租車計(jì)費(fèi)器系統(tǒng)的不足。出租車的需求不斷的增大,因此,出租車計(jì)費(fèi)器的需求也將不斷增大,計(jì)程車的服務(wù)也顯得越來越重要,因此出租車計(jì)費(fèi)器也就應(yīng)運(yùn)而生了。第2章設(shè)計(jì)目標(biāo)與主體2.1設(shè)計(jì)目標(biāo)1. 實(shí)現(xiàn)計(jì)費(fèi)功能。按行駛里程計(jì)費(fèi),起步價(jià)為6.00元,并在車行駛3km后按1.2元/km計(jì)費(fèi),當(dāng)計(jì)費(fèi)器達(dá)到或超過20元時(shí),每千米加收50%的車費(fèi),車停止和暫停時(shí)不計(jì)費(fèi);2. 現(xiàn)場(chǎng)模擬汽車的起動(dòng)、停止、暫停和換擋等狀態(tài);3. 設(shè)計(jì)數(shù)碼管動(dòng)態(tài)掃描電路,將車費(fèi)和路程顯示出來,各有兩位小數(shù)。2.2設(shè)計(jì)主

4、體假設(shè)出租車有啟動(dòng)鍵、停止鍵、暫停鍵和檔位鍵。啟動(dòng)鍵為脈沖觸發(fā)信號(hào),當(dāng)它為一個(gè)脈沖是,表示汽車已啟動(dòng),并根據(jù)車速的選擇和基本車速發(fā)出相應(yīng)頻率的脈沖(計(jì)費(fèi)脈沖)實(shí)現(xiàn)車費(fèi)和路程的計(jì)數(shù),同時(shí)車費(fèi)顯示起步價(jià);當(dāng)停止鍵為高電平時(shí),表示汽車熄火,同時(shí)停止發(fā)出脈沖,此時(shí)車費(fèi)和路程計(jì)數(shù)清零;當(dāng)暫停鍵為高電平時(shí),表示汽車暫停并停止發(fā)出脈沖,此時(shí)車費(fèi)和路程計(jì)數(shù)暫停;檔位鍵用來改變車速,不同檔位對(duì)應(yīng)著不同的車速,同時(shí)路程計(jì)數(shù)的速度也不同。首先設(shè)計(jì)taxi計(jì)費(fèi)模塊,實(shí)現(xiàn)計(jì)費(fèi)功能。起步價(jià)為6.00元,并在車行駛3km后按1.2元/km計(jì)費(fèi),當(dāng)計(jì)費(fèi)器達(dá)到或超過20元時(shí),每千米加收50%的車費(fèi),車停止和暫停時(shí)不計(jì)費(fèi)。其次將

5、輸出的費(fèi)用和路程作為輸入,給decoder模塊,完成數(shù)碼管顯示功能,并且對(duì)小數(shù)點(diǎn)等做出明確定義。2.3系統(tǒng)框圖出租車計(jì)費(fèi)器可分為兩大模塊,即控制模塊和譯碼顯示模塊,系統(tǒng)框圖如圖2.3所示,控制模塊實(shí)現(xiàn)了計(jì)費(fèi)和路程的技術(shù),并且通過不同的檔位控制車速。譯碼顯示模塊實(shí)現(xiàn)了十進(jìn)制到4位十進(jìn)制的轉(zhuǎn)換,以及車費(fèi)和路程的顯示??刂颇K計(jì)費(fèi)時(shí)鐘顯示模塊檔位起動(dòng)暫停停止圖2.3 出租車計(jì)費(fèi)器系統(tǒng)框圖第3章 主體電路與波形仿真3.1兩個(gè)模塊生成符號(hào)文件電路符號(hào),其中clk為計(jì)費(fèi)時(shí)鐘脈沖信號(hào)輸入端,clk20MHZ為譯碼高頻時(shí)鐘信號(hào)輸入端,start為汽車啟動(dòng)鍵,stop為汽車停止鍵,pause為汽車暫停鍵,spe

6、ed【1.0】為檔位鍵,scan【7.0】為數(shù)碼管地址選擇信號(hào)輸出端,seg7【6.0】為7段顯示控制信號(hào)輸出端,dp為小數(shù)點(diǎn)信號(hào)輸出端。 圖3.1.1 taxi模塊生成符號(hào)文件 圖3.1.2 decoder模塊生成符號(hào)文件3.2對(duì)taxi模塊進(jìn)行波形仿真觀察到的現(xiàn)象對(duì)控制模塊taxi進(jìn)行仿真后得到的功能仿真結(jié)果如圖3.2所示。觀察波形可知,當(dāng)起動(dòng)鍵(start)為一個(gè)脈沖時(shí),表示汽車已起動(dòng),車費(fèi)money顯示起步價(jià)6.00元,同時(shí)路程distance隨著計(jì)費(fèi)脈沖開始計(jì)數(shù);當(dāng)停止鍵(stop)為1時(shí),表示汽車熄火停止,車費(fèi)money和路程distance均為0;當(dāng)暫停鍵(pause)為1時(shí),車

7、費(fèi)和路程停止計(jì)數(shù);當(dāng)檔位鍵分別取0、2、3時(shí)路程的計(jì)數(shù)逐漸加快,表示車速逐漸加快。 圖3.2 taxi模塊波形仿真3.3對(duì)decoder模塊進(jìn)行波形仿真觀察到的現(xiàn)象將掃描數(shù)碼管的分頻系數(shù)改小后對(duì)譯碼顯示模塊decoder的功能仿真結(jié)果如圖3.3所示。進(jìn)行譯碼的時(shí)鐘頻率必須比計(jì)費(fèi)的時(shí)鐘高得多才能實(shí)時(shí)顯示出車費(fèi)和路程的變化,這里直接采用晶振時(shí)鐘20MHz即可。 圖3.3 decoder模塊波形仿真3.4整機(jī)電路的連接連接整機(jī)電路我們是通過前面生成的taxi模塊和decoder模塊進(jìn)行搭接電路的,其電路如圖3.4所示。整機(jī)電路的搭接與實(shí)現(xiàn),讓我們更加具體和直觀的看到我們對(duì)出租車計(jì)價(jià)器的仿真效果。更好

8、的證明了仿真與實(shí)物很接近。 圖3.4 整機(jī)電路圖第4章程序的設(shè)計(jì)4.1 taxi模塊程序 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity taxi isport(clk:in std_logic;-計(jì)費(fèi)時(shí)鐘 start:in std_logic;-汽車起動(dòng) stop:in std_logic;-汽車停止 pause:in std_logic;-汽車暫停 speedup:in std_logic_vector(1 downto 0);-檔位(4個(gè)檔位) money:out intege

9、r range 0 to 8000;-車費(fèi) distance:out integer range 0 to 8000);-路程end;architecture one of taxi isbeginprocess(clk,start,stop,pause,speedup) variable money_reg,distance_reg:integer range 0 to 8000;-車費(fèi)和路程的寄存器 variable num:integer range 0 to 9;-控制車速的計(jì)數(shù)器 variable dis:integer range 0 to 100;-千米計(jì)數(shù)器 variable

10、d:std_logic;-千米標(biāo)志位beginif stop='1'then-汽車停止,計(jì)費(fèi)和路程清零 money_reg:=0; distance_reg:=0; dis:=0; num:=0;elsif start='1'then-汽車起動(dòng)后,起步價(jià)為6元 money_reg:=600; distance_reg:=0; dis:=0; num:=0;elsif clk'event and clk='1'then if start='0'and speedup="00"and pause='

11、0' and stop='0'then-1檔 if num=9 then num:=0; distance_reg:=distance_reg+1; dis:=dis+1; else num:=num+1; end if; elsif start='0'and speedup="01"and pause='0' and stop='0'then-2檔 if num=9 then num:=0; distance_reg:=distance_reg+2; dis:=dis+2; else num:=num

12、+1; end if; elsif start='0'and speedup="10"and pause='0' and stop='0'then-3檔 if num=9 then num:=0; distance_reg:=distance_reg+5; dis:=dis+5; else num:=num+1; end if; elsif start='0'and speedup="11"and pause='0' and stop='0'then-4檔 d

13、istance_reg:=distance_reg+1; dis:=dis+1; end if; if dis>=100 then d:='1' dis:=0; else d:='0' end if; if distance_reg>=300 then-如果超過3km按1.2元/千米計(jì)算 if money_reg<2000 and d='1'then money_reg:=money_reg+120; elsif money_reg>=2000 and d='1'then money_reg:=money_

14、reg+180;-當(dāng)計(jì)費(fèi)器達(dá)到20元,每千米加收50%的車費(fèi) end if; end if; end if; money<=money_reg; distance<=distance_reg; end process; end;4.2 decoder模塊程序 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity decoder isport(clk20mhz:in std_logic;-系統(tǒng)時(shí)鐘20MHZ money_in:in integer range 0 to 8000;

15、-車費(fèi) distance_in:in integer range 0 to 8000;-路程 scan:out std_logic_vector(7 downto 0);-數(shù)碼管地址選擇信號(hào) seg7:out std_logic_vector(6 downto 0);-7段顯示控制信號(hào)(abcdefg) dp:out std_logic);-小數(shù)點(diǎn)end;architecture one of decoder issignal clk1khz:std_logic;-1KHZ的分頻時(shí)鐘,用于掃描數(shù)碼管地址signal data:std_logic_vector(3 downto 0);signa

16、l m_one,m_ten,m_hun,m_tho:std_logic_vector(3 downto 0);-錢數(shù)的4位十進(jìn)制表示signal d_one,d_ten,d_hun,d_tho:std_logic_vector(3 downto 0);-路程的4位十進(jìn)制表示begin-1KHZ分頻,用于掃描數(shù)碼管地址-process(clk20mhz)variable count:integer range 0 to 9999;beginif clk20mhz'event and clk20mhz='1'then if count=9999 then clk1khz&l

17、t;=not clk1khz;count:=0; else count:=count+1; end if;end if;end process;-將車費(fèi)的十進(jìn)制數(shù)轉(zhuǎn)化為4位十進(jìn)制數(shù)-process(clk20mhz,money_in) variable comb1:integer range 0 to 8000; variable comb1_a,comb1_b,comb1_c,comb1_d:std_logic_vector(3 downto 0);beginif clk20mhz'event and clk20mhz='1'then if comb1<mone

18、y_in then if comb1_a=9 and comb1_b=9 and comb1_c=9 then comb1_a:="0000" comb1_b:="0000" comb1_c:="0000" comb1_d:=comb1_d+1; comb1:=comb1+1; elsif comb1_a=9 and comb1_b=9 then comb1_a:="0000" comb1_b:="0000" comb1_c:=comb1_c+1; comb1:=comb1+1; elsif c

19、omb1_a=9 then comb1_a:="0000" comb1_b:=comb1_b+1; comb1:=comb1+1; else comb1_a:=comb1_a+1; comb1:=comb1+1; end if; elsif comb1=money_in then m_one<=comb1_a; m_ten<=comb1_b; m_hun<=comb1_c; m_tho<=comb1_d; elsif comb1>money_in then comb1_a:="0000" comb1_b:="000

20、0" comb1_c:="0000" comb1_d:="0000" comb1:=0; end if;end if;end process;-將路程的十進(jìn)制轉(zhuǎn)化為4位十進(jìn)制數(shù)-process(clk20mhz,distance_in) variable comb2:integer range 0 to 8000; variable comb2_a,comb2_b,comb2_c,comb2_d:std_logic_vector(3 downto 0);beginif clk20mhz'event and clk20mhz='1

21、'then if comb2<distance_in then if comb2_a=9 and comb2_b=9 and comb2_c=9 then comb2_a:="0000" comb2_b:="0000" comb2_c:="0000" comb2_d:=comb2_d+1; comb2:=comb2+1; elsif comb2_a=9 and comb2_b=9 then comb2_a:="0000" comb2_b:="0000" comb2_c:=comb2

22、_c+1; comb2:=comb2+1; elsif comb2_a=9 then comb2_a:="0000" comb2_b:=comb2_b+1; comb2:=comb2+1; else comb2_a:=comb2_a+1; comb2:=comb2+1; end if;elsif comb2=distance_in then d_one<=comb2_a; d_ten<=comb2_b; d_hun<=comb2_c; d_tho<=comb2_d;elsif comb2>distance_in then comb2_a:=&q

23、uot;0000" comb2_b:="0000" comb2_c:="0000" comb2_d:="0000" comb2:=0; end if;end if;end process;-數(shù)碼管動(dòng)態(tài)掃描process(clk1khz,m_one,m_ten,m_hun,m_tho,d_one,d_ten,d_hun,d_tho)variable cnt:std_logic_vector(2 downto 0);beginif clk1khz'event and clk1khz='1'then cnt

24、:=cnt+1;end if;case cnt is when"000"=>data<=m_one;dp<='0'scan<="" when"001"=>data<=m_ten;dp<='0'scan<="" when"010"=>data<=m_hun;dp<='1'scan<="" when"011"=>data<=m_t

25、ho;dp<='0'scan<="" when"100"=>data<=d_one;dp<='0'scan<="" when"101"=>data<=d_ten;dp<='0'scan<="" when"110"=>data<=d_hun;dp<='1'scan<="" when"111"=>data<=d_tho;dp<='0'scan<=""end case;end process;-7段譯碼-process(data)begincase data is when"0000"=>seg7<="" when"0001"=>seg7<="" when"0010"=>seg7<=""

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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)論