版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、精選文檔一、 課題要求(1) 技術要求1.把握較簡單規(guī)律的設計、調(diào)試。2. 進一步把握用VHDL語言設計數(shù)字規(guī)律電路。3.把握用quartusII6.0軟件進行編程設計。(2) 功能要求1.能實現(xiàn)計費功能,計費標準為:按行駛里程收費,起步費為7.00元,并在車行3公里后再按2.2元/公里,當計費器達到或超過肯定收費(如20元)。每公里加收50%的車費,車停止不計費2 .實現(xiàn)預置功能、每公里收費、車行駛加費里程。3.實現(xiàn)模擬功能:能模擬汽車啟動、停止、暫停、車速等狀態(tài)。4. 設計動態(tài)掃描電路將車費顯示出來。有兩位小數(shù)。5. 用VHDL語言設計符合上述功能要求的出租車計費器。并用層次化設計方法設計
2、該電路。6 .各計數(shù)器的技術狀態(tài)用功能的方法驗證,并用有關波形確認電路設計是否正確7. 完成電路全部設計后,通過系統(tǒng)試驗箱下載驗證設計課題的正確性。二 本人工作:本人主要負責軟件和硬件電路方面的設計,并進行引腳設定,以及與軟硬件之間的調(diào)試運行,準時修改程序,掛念查找和分析問題,確保能夠成功完成出租車計費器的設計。三 設計方案:3.1 主要中心組成顯示模塊FPGA按鍵模塊 3.2 FPGA芯片內(nèi)部主要程序:3.3 工作原理:基于CPLDFPGA的出租車計費器的組成如圖1所示。各部分主要功能如下:(1)A計數(shù)器對車輪傳感器送來的脈沖信號進行計數(shù)(每轉(zhuǎn)一圈送一個脈沖)。不同車型的車輪直徑可能不一樣,
3、通過“設置1”對車型做出選擇,以實現(xiàn)對不同車輪直徑的車進行調(diào)整。(2)B計數(shù)器對百米脈沖進行累加,并輸出實際公里數(shù)的BCD碼給譯碼動態(tài)掃描模塊。每計滿500送出一個脈沖給C計數(shù)器?!霸O置2”實現(xiàn)起步公里數(shù)預制。(3)C計數(shù)器實現(xiàn)步長可變(即單價可調(diào))的累加計數(shù),每500米計費一次?!霸O置3”用來完成超價加費、起步價預制等。(4)譯碼動態(tài)掃描將路程與費用的數(shù)值譯碼后用動態(tài)掃描的方式驅(qū)動數(shù)碼管。(5)數(shù)碼管顯示將公里數(shù)和計費金額均用四位LED數(shù)碼管顯示(2位整數(shù),2位小數(shù))。3.4功能模塊設計出租車計費器由車型調(diào)整模塊、計程模塊、計費模塊、譯碼動態(tài)及掃描等模塊組成,整個系統(tǒng)接受模塊化設計,首先用V
4、HDL編寫功能模塊,然后用頂層原理圖將各功能模塊連接起來。四 單元模塊設計:首先出租車計費器的設計需要分頻,所以需要設計了兩個頻率:4.1 oneMHZ:由于給定的50MHZ太大,這個程序完成5000分頻,實現(xiàn)第一次分頻,確保實現(xiàn)動態(tài)計數(shù),并且保證頻率在驅(qū)動范圍之內(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
5、 range 0 to 5000;signal Q:std_logic;beginprocess(daclk) begin if daclk'event 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:這個程序完成2500分頻,實現(xiàn)其次次分頻,確保最終數(shù)碼管顯示頻率在合適范圍library ieee;use ieee.std_logi
6、c_1164.all;entity twoMHZ is port( daclk: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 daclk'event and daclk='1' then if(data=2500) then data<=0; Q<=not Q; else data<
7、;=data+1; end if; end if;clkout<=Q;end process;end one; 4.3 Charge:實現(xiàn)計費功能,按行駛里程收費,起步費為7.00元,并在車行3公里后再按2.2元/公里,當計費器達到或超過肯定收費(如20元)。每公里加收50%的車費,車停止不計費,實現(xiàn)預置功能、每公里收費、車行駛加費里程,實現(xiàn)模擬功能,能模擬汽車啟動、停止、暫停、車速等狀態(tài),將車費顯示出來。有兩位小數(shù)。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity charge
8、 is port( cp,ks,tz,zt: in std_logic; dis,mon : out integer range 0 to 9999);end charge;architecture ch of charge isbegin process(cp,ks,tz,zt) variable dis1,mon1:integer range 0 to 9999; begin if(cp'event and cp='1') then if(tz='0')then dis1:=0;mon1:=0; elsif(ks='0') then
9、dis1:=0;mon1:=700; elsif(ks='1'and tz='1'and zt='1') then dis1:=dis1+10; elsif(ks='1'and tz='1'and zt='0') then dis1:=dis1;mon1:=mon1; end if; if(dis1<300) then null; elsif(dis1<600 and dis1>300) then mon1:=mon1+22; elsif(dis1>=600) then mo
10、n1:=mon1+33; end if; mon<=mon1;dis<=dis1; end if; end process;end ch; 4.4 Transform 實現(xiàn)將電路計數(shù)分凹凸位顯示,將二進制轉(zhuǎn)化為數(shù)碼管可識別的十進制library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity transform isport( daclk : std_logic; dis,mon :integer range 0 to 9999; dg,ds,db,dq,mg,ms,mb,mq: out
11、 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(daclk'event and daclk='1') then if(d<dis) then if(d1=9 and d2=9 and d3=9) then d1:="
12、;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
13、"d4:="0000" 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(daclk'event and daclk='1') then if(m<mon) then if(m1=9 and m2=9 and m3=9) then
14、 m1:="0000"m2:="0000"m3:="0000"m4:=m4+1;m:=m+1; elsif(m1=9 and m2=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:=&
15、quot;0000"m4:="0000" end if;end if;mg<=m1;ms<=m2;mb<=m3;mq<=m4;end process;end tran;4.5 Sel 通過選擇器將路程和車費每位分別輸出,送到數(shù)碼管library ieee; use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity sel isport( c:in std_logic_vector(2 downto 0); dg,ds,db,dq,mg,ms,mb,mq:in std
16、_logic_vector(3 downto 0); da:out std_logic_vector(3 downto 0) ); end sel;architecture se of sel isbegin process(c,dg,ds,db,dq,mg,ms,mb,mq) variable co :std_logic_vector(2 downto 0); begin co:=c; case co is when "000"=>da<=dg; when "001"=>da<=ds;when "010"=&
17、gt;da<=db; when "011"=>da<=dq;when "100"=>da<=mg; when "101"=>da<=ms;when "110"=>da<=mb; when "111"=>da<=mq;when others=>null;end case;end process;end se;4.6 W 用第一次分頻過的脈沖實現(xiàn)八進制計數(shù),為下面實現(xiàn)動態(tài)掃描做預備library ieee;use ieee.st
18、d_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(clk'event and clk='1') then if(b="111") then b:="000&qu
19、ot; else b:=b+1; end if; end if; a<=b; end process;end ch1;4.7 38譯碼器:通過八進制計數(shù)實現(xiàn)動態(tài)掃描library ieee;use ieee.std_logic_1164.all;entity mux38a isport(d:in std_logic_vector(2 downto 0);q:out std_logic_vector(7 downto 0);end mux38a;architecture one of mux38a isbeginprocess(d)begincase d iswhen "000&
20、quot;=>q<="11101111"when "001"=>q<="11011111"when "010"=>q<="10111111"when "011"=>q<="01111111"when "100"=>q<="11111110"when "101"=>q<="11111101"when &quo
21、t;110"=>q<="11111011"when "111"=>q<="11110111"when others=>null;end case;end process;end one;4.8 數(shù)碼管顯示:顯示模塊由8個七段LED數(shù)碼管組成。各個模塊用四個數(shù)碼管,三個表示整數(shù)部分,一個表示小數(shù)部分。由于小數(shù)點的位置是固定的,因此可以將小數(shù)點接到一個固定的高電平上始終顯示。library ieee;use ieee.std-_logic_1164.all;entity led isport( a
22、: in std_logic_vector(3 downto 0);L: out std_logic_vector(6 sownto 0) );end led;architecture one of led is beginprocess(a)begincase a iswhen "0000"=>L<="0111111"when "0001"=>L<="0000110"when "0010"=>L<="1011011"when "
23、0011"=>L<="1001111"when "0100"=>L<="1100110"when "0101"=>L<="1101101" when "0110"=>L<="1111101" when "0111"=>L<="0000111"when "1000"=>L<="1111111"whe
24、n "1001"=>L<="1101111"when other =>null;end case;end process; end one;五 頂層模塊設計:將各個程序塊聯(lián)合起來,實現(xiàn)層次化設計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 st
25、d_logic_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
26、0 to 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 d
27、ownto 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
28、(6 downto 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:charg
29、e port map(cp=>aa1,ks=>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
30、,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;六 調(diào)試結(jié)果:1、下載步驟:(1) 安裝驅(qū)動插入USB下載線后,自動跳出窗口,手動設置 D:alteraquartus6.0driverusb_blaster(2)IDE環(huán)境設置Assigementsdeviceep2cst144c8 device&ping optionsconfi
31、gurationsuse configuration deviseEPCS1-編譯(3)programmer Toolshardware setupusbblasterModeSJTAG 選文件 xx.sof(4)下載成功后,先拔電源VCC再拔USB下載線。留意事項:保證下載板載斷電狀況下進行ASP或JTAG借口的插拔。引腳安裝圖:出租車計費器成功運行,軟硬件之間連接全無問題,我們成功調(diào)試出預想結(jié)果,并且增加一些附加功能,比如考慮出租車夜晚和白天計費不一樣,設計了加速計費功能,除了軟件方面,在硬件上設計了顯示燈,便于觀看哪個功能起作用。雖然再調(diào)試過程消滅了一些問題,但經(jīng)過爭辯以及觀看擺出故障,測試完軟硬件的獨立運行,我們的軟硬件之間的連接運行相當順當。七 試驗中消滅問題在編寫程序時消滅了一些問題,例如編譯錯誤,仿真結(jié)果不正確,但經(jīng)過細心檢查和查找資料,準時改正,尤其在實際頂層文件時消滅一系列問題,但很大部分是由于更部分引腳接錯造成問題。這大多由于馬虎和不嫻熟造
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度大棚蔬菜種植與農(nóng)業(yè)休閑農(nóng)業(yè)項目合作協(xié)議2篇
- 二零二五年度南京市房地產(chǎn)經(jīng)紀行業(yè)勞務派遣及銷售服務合同
- 2025年度豬場生物安全防護與防疫物資供應合同4篇
- 二手房地產(chǎn)交易安全保障與監(jiān)管合同
- 2025年水果采摘與農(nóng)家樂特色農(nóng)產(chǎn)品銷售合同3篇
- 二零二五年度企業(yè)股權激勵計劃轉(zhuǎn)讓合同
- 2025年大數(shù)據(jù)處理與分析軟件服務采購協(xié)議3篇
- 二零二五年建筑資質(zhì)掛靠與工程進度調(diào)整服務協(xié)議3篇
- 2025年度二手房買賣合同附加物業(yè)管理費結(jié)算協(xié)議3篇
- 二零二五年度大型商業(yè)綜合體工程分包管理協(xié)議2篇
- 四川省高職單招電氣技術類《電子基礎》歷年考試真題試題庫(含答案)
- 中級半導體分立器件和集成電路裝調(diào)工技能鑒定考試題庫(含答案)
- 2024年江西生物科技職業(yè)學院單招職業(yè)技能測試題庫帶解析答案
- 橋本甲狀腺炎-90天治療方案
- (2024年)安全注射培訓課件
- 2024版《建設工程開工、停工、復工安全管理臺賬表格(流程圖、申請表、報審表、考核表、通知單等)》模版
- 部編版《道德與法治》六年級下冊教材分析萬永霞
- 酒店人防管理制度
- 油田酸化工藝技術
- 上海高考英語詞匯手冊列表
- 移動商務內(nèi)容運營(吳洪貴)任務五 其他內(nèi)容類型的生產(chǎn)
評論
0/150
提交評論