




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、一、 課題要求(1) 技術(shù)要求1.掌握較復(fù)雜邏輯的設(shè)計(jì)、調(diào)試。2. 進(jìn)一步掌握用VHDL語言設(shè)計(jì)數(shù)字邏輯電路。3.掌握用quartusII6.0軟件進(jìn)行編程設(shè)計(jì)。(2) 功能要求1.能實(shí)現(xiàn)計(jì)費(fèi)功能,計(jì)費(fèi)標(biāo)準(zhǔn)為:按行駛里程收費(fèi),起步費(fèi)為7.00元,并在車行3公里后再按2.2元/公里,當(dāng)計(jì)費(fèi)器達(dá)到或超過一定收費(fèi)(如20元)。每公里加收50%的車費(fèi),車停止不計(jì)費(fèi)2 .實(shí)現(xiàn)預(yù)置功能、每公里收費(fèi)、車行駛加費(fèi)里程。3.實(shí)現(xiàn)模擬功能:能模擬汽車啟動(dòng)、停止、暫停、車速等狀態(tài)。4. 設(shè)計(jì)動(dòng)態(tài)掃描電路將車費(fèi)顯示出來。有兩位小數(shù)。5. 用VHDL語言設(shè)計(jì)符合上述功能要求的出租車計(jì)費(fèi)器。并用層次化設(shè)計(jì)方法設(shè)計(jì)該電路。
2、6 .各計(jì)數(shù)器的技術(shù)狀態(tài)用功能的方法驗(yàn)證,并用有關(guān)波形確認(rèn)電路設(shè)計(jì)是否正確7. 完成電路全部設(shè)計(jì)后,通過系統(tǒng)試驗(yàn)箱下載驗(yàn)證設(shè)計(jì)課題的正確性。二 本人工作:本人主要負(fù)責(zé)軟件和硬件電路方面的設(shè)計(jì),并進(jìn)行引腳設(shè)定,以及與軟硬件之間的調(diào)試運(yùn)行,及時(shí)修改程序,幫助查找和分析問題,確保能夠成功完成出租車計(jì)費(fèi)器的設(shè)計(jì)。三 設(shè)計(jì)方案:3.1 主要中心組成顯示模塊FPGA按鍵模塊 3.2 FPGA芯片內(nèi)部主要程序:3.3 工作原理:基于CPLDFPGA的出租車計(jì)費(fèi)器的組成如圖1所示。各部分主要功能如下:(1)A計(jì)數(shù)器對(duì)車輪傳感器送來的脈沖信號(hào)進(jìn)行計(jì)數(shù)(每轉(zhuǎn)一圈送一個(gè)脈沖)。不同車型的車輪直徑可能不一樣,通過“設(shè)
3、置1”對(duì)車型做出選擇,以實(shí)現(xiàn)對(duì)不同車輪直徑的車進(jìn)行調(diào)整。(2)B計(jì)數(shù)器對(duì)百米脈沖進(jìn)行累加,并輸出實(shí)際公里數(shù)的BCD碼給譯碼動(dòng)態(tài)掃描模塊。每計(jì)滿500送出一個(gè)脈沖給C計(jì)數(shù)器?!霸O(shè)置2”實(shí)現(xiàn)起步公里數(shù)預(yù)制。(3)C計(jì)數(shù)器實(shí)現(xiàn)步長(zhǎng)可變(即單價(jià)可調(diào))的累加計(jì)數(shù),每500米計(jì)費(fèi)一次。“設(shè)置3”用來完成超價(jià)加費(fèi)、起步價(jià)預(yù)制等。(4)譯碼動(dòng)態(tài)掃描將路程與費(fèi)用的數(shù)值譯碼后用動(dòng)態(tài)掃描的方式驅(qū)動(dòng)數(shù)碼管。(5)數(shù)碼管顯示將公里數(shù)和計(jì)費(fèi)金額均用四位LED數(shù)碼管顯示(2位整數(shù),2位小數(shù))。3.4功能模塊設(shè)計(jì)出租車計(jì)費(fèi)器由車型調(diào)整模塊、計(jì)程模塊、計(jì)費(fèi)模塊、譯碼動(dòng)態(tài)及掃描等模塊組成,整個(gè)系統(tǒng)采用模塊化設(shè)計(jì),首先用VHDL編
4、寫功能模塊,然后用頂層原理圖將各功能模塊連接起來。四 單元模塊設(shè)計(jì):首先出租車計(jì)費(fèi)器的設(shè)計(jì)需要分頻,所以需要設(shè)計(jì)了兩個(gè)頻率:4.1 oneMHZ:由于給定的50MHZ太大,這個(gè)程序完成5000分頻,實(shí)現(xiàn)第一次分頻,確保實(shí)現(xiàn)動(dòng)態(tài)計(jì)數(shù),并且保證頻率在驅(qū)動(dòng)范圍之內(nèi)。library ieee;use ieee.std_logic_1164.all;entity oneMHZ is port( daclk:in std_logic; clkout:out std_logic); end oneMHZ;architecture one of oneMHZ issignal data:integer ran
5、ge 0 to 5000;signal Q:std_logic;beginprocess(daclk) begin if daclkevent and daclk=1 then if(data=5000) then data=0; Q=not Q; else data=data+1; end if; end if;clkout=Q;end process;end one;4.2 twoMHZ:這個(gè)程序完成2500分頻,實(shí)現(xiàn)第二次分頻,確保最后數(shù)碼管顯示頻率在合適范圍library ieee;use ieee.std_logic_1164.all;entity twoMHZ is port( d
6、aclk:in std_logic; clkout:out std_logic); end twoMHZ;architecture one of twoMHZ issignal data:integer range 0 to 2500;signal Q:std_logic;beginprocess(daclk) begin if daclkevent and daclk=1 then if(data=2500) then data=0; Q=not Q; else data=data+1; end if; end if;clkout=Q;end process;end one; 4.3 Cha
7、rge:實(shí)現(xiàn)計(jì)費(fèi)功能,按行駛里程收費(fèi),起步費(fèi)為7.00元,并在車行3公里后再按2.2元/公里,當(dāng)計(jì)費(fèi)器達(dá)到或超過一定收費(fèi)(如20元)。每公里加收50%的車費(fèi),車停止不計(jì)費(fèi),實(shí)現(xiàn)預(yù)置功能、每公里收費(fèi)、車行駛加費(fèi)里程,實(shí)現(xiàn)模擬功能,能模擬汽車啟動(dòng)、停止、暫停、車速等狀態(tài),將車費(fèi)顯示出來。有兩位小數(shù)。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity charge is port( cp,ks,tz,zt: in std_logic; dis,mon : out integer range 0
8、 to 9999);end charge;architecture ch of charge isbegin process(cp,ks,tz,zt) variable dis1,mon1:integer range 0 to 9999; begin if(cpevent and cp=1) then if(tz=0)then dis1:=0;mon1:=0; elsif(ks=0) then dis1:=0;mon1:=700; elsif(ks=1and tz=1and zt=1) then dis1:=dis1+10; elsif(ks=1and tz=1and zt=0) then d
9、is1:=dis1;mon1:=mon1; end if; if(dis1300) then null; elsif(dis1300) then mon1:=mon1+22; elsif(dis1=600) then mon1:=mon1+33; end if; mon=mon1;dis=dis1; end if; end process;end ch; 4.4 Transform 實(shí)現(xiàn)將電路計(jì)數(shù)分高低位顯示,將二進(jìn)制轉(zhuǎn)化為數(shù)碼管可識(shí)別的十進(jìn)制library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ent
10、ity transform isport( daclk : std_logic; dis,mon :integer range 0 to 9999; dg,ds,db,dq,mg,ms,mb,mq: out std_logic_vector(3 downto 0);end transform;architecture tran of transform isbegin process(daclk,dis)variable d :integer range 0 to 9999;variable d1,d2,d3,d4 :std_logic_vector(3 downto 0);begin if(
11、daclkevent and daclk=1) then if(ddis) then if(d1=9 and d2=9 and d3=9) then d1:=0000;d2:=0000;d3:=0000; d4:=d4+1;d:=d+1; elsif(d1=9 and d2=9) then d1:=0000;d2:=0000;d3:=d3+1;d:=d+1; elsif(d1=9) then d1:=0000;d2:=d2+1;d:=d+1; else d1:=d1+1;d:=d+1; end if; else d:=0;d1:=0000;d2:=0000;d3:=0000;d4:=0000;
12、 end if;end if;dg=d1;ds=d2;db=d3;dq=d4;end process;process(daclk,mon)variable m :integer range 0 to 9999;variable m1,m2,m3,m4 :std_logic_vector(3 downto 0);begin if(daclkevent and daclk=1) then if(mmon) then if(m1=9 and m2=9 and m3=9) then m1:=0000;m2:=0000;m3:=0000;m4:=m4+1;m:=m+1; elsif(m1=9 and m
13、2=9) then m1:=0000;m2:=0000;m3:=m3+1;m:=m+1; elsif(m1=9) then m1:=0000;m2:=m2+1;m:=m+1; else m1:=m1+1;m:=m+1; end if; else m:=0;m1:=0000;m2:=0000;m3:=0000;m4:=0000; end if;end if;mg=m1;ms=m2;mb=m3;mqdadadadadadadadanull;end case;end process;end se;4.6 W 用第一次分頻過的脈沖實(shí)現(xiàn)八進(jìn)制計(jì)數(shù),為下面實(shí)現(xiàn)動(dòng)態(tài)掃描做準(zhǔn)備library ieee;use
14、 ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity w isport( clk:in std_logic; a:out std_logic_vector(2 downto 0);end w;architecture ch1 of w isbegin process(clk) variable b:std_logic_vector(2 downto 0); begin if(clkevent and clk=1) then if(b=111) then b:=000; else b:=b+1; end if; end i
15、f; aqqqqqqqqnull;end case;end process;end one;4.8 數(shù)碼管顯示:顯示模塊由8個(gè)七段LED數(shù)碼管組成。各個(gè)模塊用四個(gè)數(shù)碼管,三個(gè)表示整數(shù)部分,一個(gè)表示小數(shù)部分。由于小數(shù)點(diǎn)的位置是固定的,因此可以將小數(shù)點(diǎn)接到一個(gè)固定的高電平上一直顯示。library ieee;use ieee.std-_logic_1164.all;entity led isport( a : in std_logic_vector(3 downto 0);L: out std_logic_vector(6 sownto 0) );end led;architecture one
16、of led is beginprocess(a)begincase a iswhen 0000=LLLLLLLLLLnull;end case;end process; end one;五 頂層模塊設(shè)計(jì):將各個(gè)程序塊聯(lián)合起來,實(shí)現(xiàn)層次化設(shè)計(jì)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity taxi isport(cp,start,stop,pause:in std_logic; ss1:out std_logic_vector(7 downto 0); ss2:out std_log
17、ic_vector(6 downto 0);end entity taxi;architecture ym of taxi iscomponent oneMHZport(daclk:in std_logic; clkout:out std_logic);end component;component twoMHZport(daclk:in std_logic;clkout:out std_logic);end component;component chargeport( cp,ks,tz,zt : in std_logic; dis,mon : out integer range 0 to
18、9999);end component;component transformport(daclk : std_logic; dis,mon :integer range 0 to 9999; dg,ds,db,dq,mg,ms,mb,mq: out std_logic_vector(3 downto 0);end component;component wport(clk:in std_logic; a:out std_logic_vector(2 downto 0);end component;component selport(c:in std_logic_vector(2 downto
19、 0); dg,ds,db,dq,mg,ms,mb,mq:in std_logic_vector(3 downto 0); da:out std_logic_vector(3 downto 0);end component;component mux38aport(d:in std_logic_vector(2 downto 0); q:out std_logic_vector(7 downto 0);end component;component ledport( a : in std_logic_vector(3 downto 0);L: out std_logic_vector(6 do
20、wnto 0);end component;signal aa0,aa1:std_logic;signal a0,b0:integer range 0 to 9999;signal b2,a1,b1,c1,d1,e1,f1,g1,h1:std_logic_vector(3 downto 0);signal y:std_logic_vector(2 downto 0);beginu0:oneMHZ port map(daclk=cp,clkout=aa0);u1:twoMHZ port map(daclk=aa0,clkout=aa1);u2:charge port map(cp=aa1,ks=
21、start,tz=stop,zt=pause,dis=a0,mon=b0);u3:transform port map(daclk=aa0,dis=a0,mon=b0,dg=a1,ds=b1,db=c1,dq=d1,mg=e1,ms=f1,mb=g1,mq=h1);u4:w port map(clk=aa0,a=y);u5:sel port map(c=y,dg=a1,ds=b1,db=c1,dq=d1,mg=e1,ms=f1,mb=g1,mq=h1,da=b2);u6:mux38a port map (d=y,q=ss1);u7:led port map(a=b2,L=ss2);end ym
22、;六 調(diào)試結(jié)果:1、下載步驟:(1) 安裝驅(qū)動(dòng)插入U(xiǎn)SB下載線后,自動(dòng)跳出窗口,手動(dòng)設(shè)置 D:alteraquartus6.0driverusb_blaster(2)IDE環(huán)境設(shè)置Assigementsdeviceep2cst144c8 device&ping optionsconfigurationsuse configuration deviseEPCS1-編譯(3)programmer Toolshardware setupusbblasterModeSJTAG 選文件 xx.sof(4)下載成功后,先拔電源VCC再拔USB下載線。注意事項(xiàng):保證下載板載斷電情況下進(jìn)行ASP或JTAG借口
23、的插拔。引腳安裝圖:出租車計(jì)費(fèi)器成功運(yùn)行,軟硬件之間銜接全無問題,我們成功調(diào)試出預(yù)想結(jié)果,并且增加一些附加功能,比如考慮出租車夜晚和白天計(jì)費(fèi)不一樣,設(shè)計(jì)了加速計(jì)費(fèi)功能,除了軟件方面,在硬件上設(shè)計(jì)了顯示燈,便于觀察哪個(gè)功能起作用。雖然再調(diào)試過程出現(xiàn)了一些問題,但經(jīng)過討論以及觀察擺出故障,測(cè)試完軟硬件的獨(dú)立運(yùn)行,我們的軟硬件之間的銜接運(yùn)行相當(dāng)順利。七 實(shí)驗(yàn)中出現(xiàn)問題在編寫程序時(shí)出現(xiàn)了一些問題,例如編譯錯(cuò)誤,仿真結(jié)果不正確,但經(jīng)過細(xì)心檢查和查找資料,及時(shí)改正,尤其在實(shí)際頂層文件時(shí)出現(xiàn)一系列問題,但很大部分是由于更部分引腳接錯(cuò)造成問題。這大多由于粗心和不熟練造成的。在此過程中浪費(fèi)了一些時(shí)間。并且在下載過程中,盡管操作不熟練,但還是順利完成。再軟硬件連接過程中,出現(xiàn)了一系列問題,剛開始出現(xiàn)亂碼,經(jīng)檢查是數(shù)碼管和FPGA引腳連錯(cuò)了,接著出現(xiàn)顯示沒有置數(shù)功能,經(jīng)核查后發(fā)現(xiàn)為軟硬件不協(xié)調(diào),除此之外還有由于頻率太快,造成顯示太快,無法看清示數(shù)顯示,經(jīng)過一系列修改后終于達(dá)到預(yù)期要求,并增加附加功能。八、設(shè)計(jì)小結(jié)出租車計(jì)費(fèi)器系統(tǒng)的設(shè)計(jì)已全部完成,能按預(yù)期的效果進(jìn)行模擬汽車啟動(dòng)、停止、暫停等功能,并設(shè)計(jì)動(dòng)態(tài)掃描電路顯示車費(fèi)數(shù)目,由動(dòng)態(tài)掃描電路來完成。車暫時(shí)停止不計(jì)費(fèi),車費(fèi)保
溫馨提示
- 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. 人人文庫(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025公司廠級(jí)員工安全培訓(xùn)考試試題答案5A
- 2025年新員工崗前安全培訓(xùn)考試試題及參考答案(培優(yōu)A卷)
- 2025公司廠級(jí)安全培訓(xùn)考試試題(各地真題)
- 水利水電工程行業(yè)動(dòng)態(tài)解析試題及答案
- 行政管理中的多元公共關(guān)系學(xué)應(yīng)用試題及答案
- (高清版)DB34∕T 4991-2025 巖瀝青+SBS復(fù)合改性瀝青混合料設(shè)計(jì)與施工技術(shù)規(guī)范
- 2025-2030年針棉織品產(chǎn)業(yè)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年通信設(shè)備制造行業(yè)市場(chǎng)深度調(diào)研及競(jìng)爭(zhēng)格局與投資研究報(bào)告
- 2025-2030年輕軌交通行業(yè)市場(chǎng)深度調(diào)研及前景趨勢(shì)與投資研究報(bào)告
- 2025-2030年車軸產(chǎn)業(yè)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 赤峰市垃圾焚燒發(fā)電項(xiàng)目
- 2025年心理咨詢師執(zhí)業(yè)資格考試試題及答案
- 殯葬單位面試題及答案
- 網(wǎng)絡(luò)科學(xué)在社會(huì)網(wǎng)絡(luò)分析中的應(yīng)用-全面剖析
- 民法典講座課件
- (四調(diào))武漢市2025屆高中畢業(yè)生四月調(diào)研考試 數(shù)學(xué)試卷(含答案詳解)
- 中外比較文學(xué)研究專題智慧樹知到期末考試答案2024年
- 建設(shè)用地報(bào)批服務(wù)投標(biāo)方案(技術(shù)方案)
- 籍貫對(duì)照表完整版
- GB 20664-2006有色金屬礦產(chǎn)品的天然放射性限值
- EN779-2012一般通風(fēng)過濾器——過濾性能測(cè)定(中文版)
評(píng)論
0/150
提交評(píng)論