EDA課程設(shè)計簡易出租車計價器設(shè)計_第1頁
EDA課程設(shè)計簡易出租車計價器設(shè)計_第2頁
EDA課程設(shè)計簡易出租車計價器設(shè)計_第3頁
EDA課程設(shè)計簡易出租車計價器設(shè)計_第4頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、個人收集整理勿做商業(yè)用途封面?zhèn)€人收集整理勿做商業(yè)用途作者: Pan Hongliang僅供個人學(xué)習(xí)EDA課程 設(shè) 計RTX于2012/2/22簡易出租車計價器設(shè)計要求:計價器按 1.2 元 /公里計費,超過10 公里后,則按1.8 元 /公里收費。個人收集整理勿做商業(yè)用途起步價 6 元 (3 公里 ),超過 3 公里后 ,計價累加0.6 元, 10 公里內(nèi)以后每過0.6 元。過 10 公里后 , 計價累加0.9 元 , 以后每過0.5 公里累加0.9 元。公里數(shù) 4 位數(shù)字顯示,精確到0.1 公里 ; 出租車計價4 位數(shù)字顯示,精確到即:0.5 公里累加0.1 元。一設(shè)計方案二 硬件部分:(1

2、) 硬件環(huán)境 : 東南大學(xué)SE-5 型 EDA試驗箱 ,其中核心元件是Altera公司的EPF10K10LC84-4 ):三軟件部分:(1) 軟件環(huán)境 : Altera 公司的(2) 程序源代碼:MAX+plusII1.頂層設(shè)計 :2.各元件源代碼:元件 kms2money-kms2money.vhdlibrary ieee;-0.1 公里表示為1,0.1 元表示為1entity kms2money isport( rst, clk, enf, dispclkdata4ctl8:in:out:outstd_logic;std_logic_vector(3 downto 0);std_logic

3、_vector(7 downto 0);-data4:按 dispclk 的上升沿周期性的依次輸出 kms3,kms2,kms1,kms0,mon3,mon2,mon1,mon0-ctl8分別為控制動態(tài)掃描顯示的8 個 LED 的使能端,高電平使能:end kms2money;architecture art_kms2money of kms2money issignal kms3,kms2,kms1,kms0:std_logic_vector(3 downto 0);- 公里百位 ,十位 ,個位 , 十分位 signal mon3,mon2,mon1,mon0:std_logic_vecto

4、r(3 downto 0);-金額百位 , 十位 ,個位 ,十分位begin-dynctl:process(dispclk,kms3,kms2,kms1,kms0,mon3,mon2,mon1,mon0) -動態(tài)顯示 -dispclk 上升沿依次來臨時 data4 依次為 kms3,kms2,kms1,kms0,mon3,mon2,mon1,mon0 ,周而復(fù)始variable times:std_logic_vector(2 downto 0);-3 位可表征 8 種狀態(tài),非 '0'且非 '1'除外beginif dispclk'event and d

5、ispclk='1' thentimes:=times+1;case times iswhen "000"=>data4<=kms3;ctl8<="10000000" - 使能左起第1位 LEDwhen "001"=>data4<=kms2;ctl8<="01000000" - 使能左起第2位 LEDwhen "010"=>data4<=kms1;ctl8<="00100000" - 使能左起第3位 LED

6、個人收集整理勿做商業(yè)用途when "011"=>data4<=kms0;ctl8<="00010000" - 使能左起第4位 LEDwhen "100"=>data4<=mon3;ctl8<="00001000"- 使能左起第5位LEDwhen "101"=>data4<=mon2;ctl8<="00000100"- 使能左起第6位LEDwhen "110"=>data4<=mon1;ctl

7、8<="00000010"- 使能左起第7位LEDwhen "111"=>data4<=mon0;ctl8<="00000001" - 使能左起第8位 LEDwhen others=> data4<="ZZZZ"ctl8<="00000000" - 無效為高阻都不選中 end case;end if;end process;-kmsdisp:process(rst,clk)begin-clk 每來一次上升沿認(rèn)為公里數(shù)加0.1 公里,即加1if rst=&

8、#39;1' then kms3<="0000"kms2<="0000"kms1<="0000"kms0<="0000"- 初始數(shù)據(jù)elsif clk'event and clk='1' thenif enf='1' thenif kms0="1001" then - 按十進制相加規(guī)律加 1kms0<="0000"if kms1="1001" thenkms1<="

9、;0000"if kms2="1001" thenkms2<="0000"if kms3="1001" then kms3<="0000"else kms3<=kms3+1;end if;else kms2<=kms2+1;end if;else kms1<=kms1+1;end if;else kms0<=kms0+1;end if;end if;end if;end process;-mondisp:process(rst,clk)variable kms: std

10、_logic_vector(15 downto 0); - 公里數(shù)的十六進制值或二進制值variable times:std_logic_vector(2 downto 0); -記錄 clk 上升沿的次數(shù),即有幾個0.1 公里beginif rst='1'then mon3<="0000"mon2<="0000"mon1<="0110"mon0<="0000"kms:=(others=>'0');times:="000"elsif

11、clk'event and clk='1' thenif enf='1' thentimes:=times+1;if times=1 then個人收集整理勿做商業(yè)用途kms:=kms+5; -kms 可能為 0,5,10,.,6,65,.(5 的倍數(shù) )-kms+1(0.1 公里 )與 kms+5 在價格的角度上看是等價的-XXX.1-XXX.5公里均按XXX.5 公里看待, XXX.6-XXX.9公里均按 (XXX.9+0.1) 看待If kms<=30 then mon3<="0000"mon2<="0

12、000"mon1<="0110"mon0<="0000"- 不超過 3 公里,收起步價6.0 元elsif kms<=100 then- 超過 3 公里不超過10 公里,每 0.5 公里金額加 0.6 元;-if mon0>3 then-按十進制相加規(guī)律加6mon0<=mon0-4;-XXX4-XXX9加 6 后為 YZW0-YZW5if mon1="1001" thenmon1<="0000"if mon2="1001" thenmon2<=

13、"0000"if mon3="1001" then mon3<="0000"else mon3<=mon3+1;end if;else mon2<=mon2+1;end if;else mon1<=mon1+1;end if;else mon0<=mon0+6;-XXX0-XXX3加 6 后為 XXX6-XXX9end if;-else- 超過 10 公里,每 0.5 公里金額加0.9 元;-if mon0>0 then- 按十進制相加規(guī)律加9mon0<=mon0-1;-XXX1-XXX9加

14、9 后為 YZW0-YZW8if mon1="1001" thenmon1<="0000"if mon2="1001" thenmon2<="0000"if mon3="1001" then mon3<="0000"else mon3<=mon3+1;end if;else mon2<=mon2+1;end if;else mon1<=mon1+1;end if;else mon0<=mon0+9;-XXX0 加 9 后為 XXX9e

15、nd if;-end if;elsif times=5 then times:="000"- 每計數(shù) 5 次 clk 就重新計數(shù)以便下次"循環(huán) " 使用個人收集整理勿做商業(yè)用途-times=0,2,3,4 時參數(shù)不變,而只在times=1 時一筆帶過,被包含了.times=0 與times=5 是等效的end if;endif;end if;end process;-end art_kms2money;3.元件 seg7bcd-seg7bcd.vhdlibrary ieee;entity seg7BCD isport(turn_on:instd_logi

16、c;x:instd_logic_vector(3 downto 0);y:out std_logic_vector(6 downto 0);- 聲明 :- 共陰極 7 段顯示- turn_on :顯示使能開關(guān),高電平有效- x:4 位 BCD 碼,x(3) 為最高位 ,x(0) 為最低位- y:7 段顯示碼 ,y(6).y(0) 對應(yīng) g f e d c b aend seg7BCD;architecture art_seg7BCD of seg7BCD isbeginprocess(x,turn_on)beginif turn_on='1' thencase x is-&qu

17、ot;gfedcba"when "0000"=>y<="0111111"-0when "0001"=>y<="0000110"-1when "0010"=>y<="1011011"-2when "0011"=>y<="1001111"-3when "0100"=>y<="1100110"-4when "0101&quo

18、t;=>y<="1101101"-5when "0110"=>y<="1111101"-6when "0111"=>y<="0000111"-7when "1000"=>y<="1111111"-8when "1001"=>y<="1101111"-9when others=>y<="ZZZZZZZ"-無效end case;e

19、lse y<="0000000" -熄滅end if;end process;end art_seg7BCD;3.仿真結(jié)果個人收集整理勿做商業(yè)用途4.管腳綁定PortNumName-+LedEN7.0LedEN780LedEN681LedEN583LedEN43LedEN372LedEN273LedEN178LedEN079-+g2a6.0g2a66gg2a57fg2a48eg2a39dg2a210cg2a111bg2a016a-+inputCLK1CP1dispCLK43CP2RST28K1nPause29K25.下載程序-本程序十分簡易,僅供交流與學(xué)習(xí)。RTX 創(chuàng)

20、建于 2012-2-22 ,-The end提示: EPF10K10LC84-4不屬于 Fastest Speed Grades個人收集整理勿做商業(yè)用途版權(quán)申明本文部分內(nèi)容,包括文字、圖片、以及設(shè)計等在網(wǎng)上搜集整理。版權(quán)為潘宏亮個人所有This articleincludessome parts,includingtext,pictures,and design. Copyright is Pan Hongliang's personal ownership.用戶可將本文的內(nèi)容或服務(wù)用于個人學(xué)習(xí)、研究或欣賞,以及其他非商業(yè)性或非盈利性用途, 但同時應(yīng)遵守著作權(quán)法及其他相關(guān)法律的規(guī)定,不得侵犯本網(wǎng)站及相關(guān)權(quán)利人的合法權(quán)利。除此以外,將本文任何內(nèi)容或服務(wù)用于其他用途時,須征得本人及相關(guān)權(quán)利人的書面許可,并支付報酬。Users may use the contents or services of this article for personal study, research or appreciation, and other non-commercial or non-profit purposes, but at the same time, they shall abide by the provisions of co

溫馨提示

  • 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. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論