版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
出租車計費器出租車計費器1028頁出租車計費器的總體設計出租車計費設計該出租車計費器按下開關(guān)S1后開頭計費和計里程數(shù),分為白天和夜晚。當撥動開關(guān)K2為0時,系統(tǒng)使用程序設置的起步價,白天起步價是3元,準行2公里,以后2/公里;夜晚起步價是923/公里。當撥K210~920050根本設計思想來作為整個系統(tǒng)的復位按鈕,每復位一次,計1公里。系統(tǒng)設計是需要檢測電機的轉(zhuǎn)動狀況,每轉(zhuǎn)1000圈,分頻模塊輸出一個下降沿信號。車費和里程數(shù)874416*16K102/2;撥動開關(guān)K21,3/3。出租車計費器的總體實現(xiàn)系統(tǒng)總體框圖,主要進程有:1計程模塊進程:記錄已行里程;計費模塊進程:計算應付車費;4*4總程序〔系統(tǒng)時鐘〕4*4計費模塊分頻模塊計程模塊總程序〔系統(tǒng)時鐘〕4*4計費模塊分頻模塊計程模塊數(shù)碼管16*162-1數(shù)碼管16*16程序流程圖Count<=0Temp<=0Count<=0Temp<=0Yrstmotor信號發(fā)生變化Rst=’0’Nmotor”eventandmotor=”1”YYCount<499Count=0Temp=nottempNCount<=count+1Glclk<=temp2-2分頻模塊〔2〕計程模塊Meter1<=0;Meter1<=0;Meter10<=0;Meter100<=0;Meter1K<=0;Yrstglclk信號發(fā)生變化Rst=’0’Nglclk”eventandglclk=”0”YMeter1,meter10,meter100,meter1000代表的四位十12-3計程模塊(3)計費模塊Money1<=qibujia;Money1<=qibujia;Money10<=0;Money100<=0;Money1000<=0;Yrstclk信號發(fā)生變化Rst=’0’Nclk”eventandclk=”0”Y依據(jù)路程計算出總價,再把總價的千位、百位、十位、個位取出顯示。2-4計費模塊出租車計費器各功能的實現(xiàn),meter11.ifrst=”0”thencount<=0;elsif(motor”eventandmotor=”1”)thenifcount>499thencount<=0;temp<=nottemp;elsecount<=count+1;endif;endif;glclk<=temp;90。process(glclk)beginif(Rst=”0”)thenMeter1<=0;Meter10<=0;Meter1K<=0;elsif(glclk”eventandglclk=”0”)thenif(Meter1=9)thenMeter1<=0;if(Meter10=9)thenMeter10<=0;if(Meter100=9)thenMeter100<=0;if(Meter1K=9)thenelseendif;elseendif;elseendif;elseendif;endif;endprocess;22公里200公里,費用為〔起步價〔路程-〕*單價200公里時費〔〔路程-2〕*單價。process(clk,rst)beginif((Rst=”0”)or(lucheng<3))thenMoney1<=qibujia;Money10<=0;Money100<=0;Money1000<=0;elsif(clk”eventandclk=”0”)theniflucheng>200thenjiage<=(lucheng-2)*danjia+qibujia+50;money1000<=(jiage-(jiagemod1000))/1000;money100<=((jiagemod1000)-((jiagemod1000)mod100))/100;money10<=((jiagemod100)-(jiagemod10))/10;money1<=jiagemod10;elsejiage<=(lucheng-2)*danjia+qibujia;money1000<=(jiage-(jiagemod1000))/1000;money100<=((jiagemod1000)-((jiagemod1000)mod100))/100;money10<=((jiagemod100)-(jiagemod10))/10;money1<=jiagemod10;endif;endif;endprocess;〔4〕4*4矩陣鍵盤:有鍵按下時為低電平,脈沖掃描時先推斷行,再推斷列。process(clk)beginif(clk”eventandclk=”1”)thenif(Krow=“1111“)thenkflag1<=”0”;kcount<=kcount+1;if(kcount=0)thenKcol<=“1110“;elsif(kcount=1)thenelsif(kcount=2)thenKcol<=“1011“;elseKcol<=“0111“;else
endif;kflag1<=”1”;keyrow<=Krow;keycol<=Kcol;endif;endif;endprocess;process(clk)beginifk2=”1”thenif(clk”eventandclk=”1”)thenif(kflag1=”1”)thenif(keyrow=“0111“)thencasekeycoliswhen“0111“=>buff<=1;when“1011“=>buff<=4;when“1101“=>buff<=7;whenothers=>buff<=buff;endcase;elsif(keyrow=“1011“)thencasekeycoliswhen“0111“=>buff<=2;when“1011“=>buff<=5;when“1101“=>buff<=8;when“1110“=>buff<=0;whenothers=>buff<=buff;endcase;elsif(keyrow=“1101“)thencasekeycoliswhen“1101“=>buff<=9;when“1011“=>buff<=6;when“0111“=>buff<=3;whenothers=>buff<=buff;endcase;endif;endif;qibujia<=buff;endif;elseqibujia_d<=3; if(k1=”0”)thenqibujia<=qibujia_d;elseqibujia<=qibujia_n;endif;endif;endprocess;過提高時鐘的頻率,到達顯示的效果。process(SEG_SEL)begincase(SEG_SEL+1)iswhen“000“=> Disp_Temp<=Meter1K;when“001“=> Disp_Temp<=Meter100;when“010“=> Disp_Temp<=Meter10;when“011“=> Disp_Temp<=Meter1;when“100“=> Disp_Temp<=money1000;when“101“=> Disp_Temp<=Money100;when“110“=> Disp_Temp<=Money10;when“111“=> endcase;endprocess;process(Disp_Temp)begincaseDisp_Tempiswhen0=>Disp_Decode<=“00111111“; --0when1=>Disp_Decode<=“00000110“; --1when2=>Disp_Decode<=“01011011“; --2when3=>Disp_Decode<=“01001111“; --3when4=>Disp_Decode<=“01100110“; --4when5=>Disp_Decode<=“01101101“; --5when6=>Disp_Decode<=“01111101“; --6when7=>Disp_Decode<=“00000111“; --7when8=>Disp_Decode<=“01111111“; --8when9=>Disp_Decode<=“01101111“; whenothers=>Disp_Decode<=“00000000“;endcase;endprocess;從左到右顯示,提高時鐘頻率到達顯示效果。process(cdount)begincasecdountiswhen“0000“=>ledcol<=“0000“列選擇(lg7088Ah)when“0001“=>ledcol<=“0001“;when“0010“=>ledcol<=“0010“;when“0011“=>ledcol<=“0011“;when“0100“=>ledcol<=“0100“;when“0101“=>ledcol<=“0101“;when“0110“=>ledcol<=“0110“;when“0111“=>ledcol<=“0111“;when“1000“=>ledcol<=“1000“;when“1001“=>ledcol<=“1001“;when“1010“=>ledcol<=“1010“;when“1011“=>ledcol<=“1011“;when“1100“=>ledcol<=“1100“;when“1101“=>ledcol<=“1101“;when“1110“=>ledcol<=“1110“;when“1111“=>ledcol<=“1111“;whenothers=>ledcol<=“0000“;endcase;endprocess;30011里程數(shù)的最低位為“00000,temp1,費用增加相應的單價,符合課題要求。3-1系統(tǒng)仿真圖4總結(jié)與體會析事物的規(guī)律思維力量得到了熬煉,提高了實際動手力量。了一個又一個困難。在試驗室中,我生疏了對QuartusⅡ軟件的一般工程的操VHDL業(yè)理論學問這樣才能在以后出去工作的實踐過程中有所成果。不斷指導和同學的熱忱幫助。總的來說,這次實訓我收獲很大。AVHDLlibraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitydianzhenisport(Clk :instd_logic;--時鐘輸入k1,k2 :instd_logic;--danjiaxuanzeRst :instd_logic;--復位輸入Motor :instd_logic;--電機脈沖輸入輸出
Krow : instd_logic_vector(3downto0);Kcol : bufferstd_logic_vector(3downto0);Display : out std_logic_vector(7downto0); --七段碼管顯示SEG_SEL : buffer std_logic_vector(2downto0);七段碼管掃ledcol:outstd_logic_vector(3downto0); --點陣列掌握ledrow:outstd_logic_vector(15downto0)); 示enddianzhen;architecturebehaveofdianzhenissignalDisp_Temp:integerrange0to15;signalDisp_Decode:std_logic_vector(7downto0);signalMeter1,Meter10,Meter100,Meter1K :integerrange0to9;signalMoney1,Money10,Money100,Money1000 :integerrange0to9;signaldanjia,day,night,qibujia,qibujia_d,qibujia_n: integerrange0to9;signaltemp,glclk:std_logic;signalcount:integerrange0to500;signallucheng,jiage:integerrange0to100000;signalcdount:std_logic_vector(3downto0);signalbuff:integerrange0to15;signalkeyrow,keycol:std_logic_vector(3downto0);signalkcount:std_logic_vector(2downto0);signalkflag1:std_logic;beginprocess(motor,rst)beginday<=2; if(k1=”0”)thendanjia<=day;elsedanjia<=night;endif;ifrst=”0”thencount<=0;elsif(motor”eventandmotor=”1”)thenifcount>499thencount<=0;temp<=nottemp;elsecount<=count+1;endif;endif;glclk<=temp;endprocess;process(clk)beginif(clk”eventandclk=”1”)thenif(Krow=“1111“)thenkflag1<=”0”;kcount<=kcount+1;if(kcount=0)thenKcol<=“1110“;elsif(kcount=1)thenelsif(kcount=2)thenelseKcol<=“0111“;else
endif;kflag1<=”1”;keyrow<=Krow;keycol<=Kcol;endif;endif;endprocess;process(clk)beginifk2=”1”thenif(clk”eventandclk=”1”)thenif(kflag1=”1”)thenif(keyrow=“0111“)thencasekeycoliswhen“0111“=>buff<=1;when“1011“=>buff<=4;when“1101“=>buff<=7;whenothers=>buff<=buff;endcase;elsif(keyrow=“1011“)thencasekeycoliswhen“0111“=>buff<=2;when“1011“=>buff<=5;when“1101“=>buff<=8;when“1110“=>buff<=0;whenothers=>buff<=buff;endcase;elsif(keyrow=“1101“)thencasekeycoliswhen“1101“=>buff<=9;when“1011“=>buff<=6;when“0111“=>buff<=3;whenothers=>buff<=buff;endcase;endif;endif;qibujia<=buff;endif;elseqibujia_d<=3; if(k1=”0”)thenqibujia<=qibujia_d;elseqibujia<=qibujia_n;endif;endif;endprocess;process(glclk)beginif(Rst=”0”)thenMeter1<=0;Meter10<=0;Meter1K<=0;elsif(glclk”eventandglclk=”0”)thenif(Meter1=9)thenMeter1<=0;if(Meter10=9)thenMeter10<=0;if(Meter100=9)thenMeter100<=0;if(Meter1K=9)thenelseendif;elseendif;elseendif;elseendif;endif;endprocess;process(clk,rst)beginif((Rst=”0”)or(lucheng<3))thenMoney1<=qibujia;Money10<=0;Money100<=0;Money1000<=0;elsif(clk”eventandclk=”0”)theniflucheng>200thenjiage<=(lucheng-2)*danjia+qibujia+50;money1000<=(jiage-(jiagemod1000))/1000;money100<=((jiagemod1000)-((jiagemod1000)mod100))/100;money10<=((jiagemod100)-((jiagemod100)mod10))/10;money1<=jiagemod10;elsejiage<=(lucheng-2)*danjia+qibujia;money1000<=(jiage-(jiagemod1000))/1000;money100<=((jiagemod1000)-((jiagemod1000)mod100))/100;money10<=((jiagemod100)-(jiagemod10))/10;money1<=jiagemod10;endif;endif;endprocess;process(clk)beginif clk”event and clk=”1” thenif cdount<15 cdount<=cdount+1;elsecdount<=“0000“;end if;end if;end process(SEG_SEL)begincase(SEG_SEL+1)iswhen“000“=> Disp_Temp<=Meter1K;when“001“=> Disp_Temp<=Meter100;when“010“=> Disp_Temp<=Meter10;when“011“=> Disp_Temp<=Meter1;when“100“=> Disp_Temp<=money1000;when“101“=> Disp_Temp<=Money100;when“110“=> Disp_Temp<=Money10;when“111“=> endcase;endprocess;process(Clk)beginif(Clk”eventandClk=”1”then --掃描累加SEG_SEL<=SEG_SEL+1;Display<=Disp_Decode;endif;endprocess;process(Disp_Temp) --顯示轉(zhuǎn)換begincaseDisp_Tempiswhen0=>Disp_Decode<=“00111111“; --0when1=>Disp_Decode<=“00000110“; --1when2=>Disp_Decode<=“01011011“; --2when3=>Disp_Decode<=“01001111“; --3when4=>Disp_Decode<=“01100110“; when5=>Disp_Decode<=“01101101“; when6=>Disp_Decode<=“01111101“; --6when7=>Disp_Decode<=“00000111“; when8=>Disp_Decode<=“01111111“; --8when9=>Disp_Decode<=“01101111“; whenothers=>Disp_Decode<=“00000000“;endcase;endprocess;process(cdount)begincasecdountiswhen“0000“=>ledcol<=“0000“列選擇when“0001“=>ledcol<=“0001“;when“0010“=>ledcol<=“0010“;when“0011“=>ledcol<=“0011“;when“0100“=>ledcol<=“0100“;when“0101“=>ledcol<=“0101“;when“0110“=>ledcol<=“0110“;when“0111“=>ledcol<=“0111“;when“1000“=>ledcol<=“1000“;when“1001“=>ledcol<=“1001“;when“1010“=>ledcol<=“1010“;when“1011“=>ledcol<=“1011“;when“1100“=>ledcol<=“1100“;when“1101“=>ledcol<=“1101“;when“1110“=>ledcol<=“1110“;whenothers=>ledcol<=“0000“;
--全滅endcase;endprocess;process(danjia)beginifdanjia=0thencasecdountiswhen“0000“=>ledrow<=“1111111111111111“-whenothers=>ledrow<=“1111111111111111“;endcase;elsifdanjia=1thencasecdountiswhen“0000“=>ledrow<=“1111111111111111“-
01出租車計費器出租車計費器2128頁whenothers=>ledrow<=“1111111111111111“;endcase;elsif danjia=2 thencasecdountiswhen“0000“=>ledrow<=“1111111111111111“-when“0001“=>ledrow<=“1111111111111111“;when“0010“=>ledrow<=“1111111111111111“;when“0011“=>ledrow<=“1111111111111111“;when“0100“=>ledrow<=“1100000001110011“;
2出租車計費器出租車計費器2228頁when“1111“=>ledrow<=“1111111111111111“;whenothers=>ledrow<=“1111111111111111“;endcase;elsif danjia=3 thencasecdountiswhen“0000“=>ledrow<=“1111111111111111“-when“0001“=>ledrow<=“1111111111111111“;when“0010“=>ledrow<=“1111111111111111“;when“0011“=>ledrow<=“1111111111111111“;when“0100“=>ledrow<=“1100111001110011“;whenothers=>ledrow<=“1111111111111111“;endcase;elsif danjia=4 casecdountiswhen“0000“=>ledrow<=“1111111111111111“-when“0001“=>ledrow<=“1111111111111111“;when“0010“=>ledrow<=“1111111111111111“;
34出租車計費器出租車計費器2328頁whenothers=>ledrow<=“1111111111111111“;endcase;elsif danjia=5 thencasecdountiswhen“0000“=>ledrow<=“1111111111111111“-when“0001“=>ledrow<=“1111111111111111“;when“0010“=>ledrow<=“1111111111111111“;when“0011“=>ledrow<=“1111111111111111“;when“0100“=>ledrow<=“1100111000000011“;
5出租車計費器出租車計費器2428頁when“1111“=>ledrow<=“1111111111111111“;whenothers=>ledrow<=“11111111
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 交通安全承臺施工協(xié)議
- 音樂版權(quán)企業(yè)股權(quán)登記
- 園林綠化鍋爐房改造合同
- 教育信息化服務外債登記管理規(guī)范
- 電子商務合規(guī)法律事務辦法
- 2025工廠生產(chǎn)承包合同范本
- 碼頭防病毒裝卸規(guī)定
- 地震監(jiān)測樁機租賃合同
- 有色金屬公司財務人員聘用協(xié)議
- 餐飲配送服務承諾書模板
- 山東省濱州市2023-2024學年高一上學期1月期末考試 政治 含答案
- 電力行業(yè)電力調(diào)度培訓
- 【MOOC】氣排球-東北大學 中國大學慕課MOOC答案
- 全力以赴備戰(zhàn)期末-2024-2025學年上學期備戰(zhàn)期末考試主題班會課件
- 《慶澳門回歸盼祖國統(tǒng)一》主題班會教案
- 物流公司自然災害、突發(fā)性事件應急預案(2篇)
- 《視頻拍攝與制作:短視頻?商品視頻?直播視頻(第2版)》-課程標準
- 公司戰(zhàn)略與風險管理戰(zhàn)略實施
- 2024年-2025年《農(nóng)作物生產(chǎn)技術(shù)》綜合知識考試題庫及答案
- 洗衣房工作人員崗位職責培訓
- 廣東省深圳市光明區(qū)2022-2023學年五年級上學期數(shù)學期末試卷(含答案)
評論
0/150
提交評論