【正文】
clkout :in std_logic。 end process。139。 kmt3:out std_logic_vector(3 downto 0) )。 end process。then t_state:=t0。 when t2= waittime:=waittime+1。139。then 復位清零 t_state:=t0。 sp :in std_logic_vector(2 downto 0)。 end rtl。139。 when s1= clkout=39。then 時鐘上升沿到達時,狀態(tài)轉(zhuǎn)換 case s_state is when s0= t:=0。 第六檔 when111=kinside:=4。 variable kinside:integer range 0 to 30。 start:in std_logic。 致謝 本次設計從選題到最后完成,都得到了指導老師邵利敏老師的悉心指導。 圖 55 計費模塊仿真功能圖 綜上所述,本設計的出租車計費器完全符合系統(tǒng)設計的要求,實現(xiàn)了出租車計費器所需的各項基本功能。 9 圖 51 出租車計費器仿真波形圖 速度模塊仿真 速度模塊的仿真波形圖如圖 52 所示。再次按下鍵后,開關換到另外的兩路,空車指示燈亮起。 圖 35 計費模塊框圖 整體電路圖 整體電路如圖 41。 圖 34 計時模塊框圖 計費模塊 計費模塊如圖 36所示,可分為 kmmoney1 和 kmmoney2 兩個進程。 VHDL 語言程序見附錄,模塊原件符號如下。當 sp=0 時,開始記錄時間。 總體框架設計 4 圖 31 出租車計 費器系統(tǒng)結構圖 系統(tǒng)接收到 reset 信號后,總費用變?yōu)?3元,同時其他計數(shù)器、寄存器等全部清零。 CPLD 器件已成為電子產(chǎn)品不可缺少的組成部分,它的設計和應用成為電子工程師必備的一種技能。為彌補 PLD只能設計小規(guī)模電路這一缺陷,推出了復雜 可編程邏輯器件 —— CPLD。 此次選做的畢業(yè)課題是“基于 CPLD 的租出車計費器”,利用現(xiàn)在已經(jīng)很成熟的可編程邏輯器件來實現(xiàn)這一計費系統(tǒng),相對用 51 單片而言,會比較簡單,這也同樣體現(xiàn)出EDA 技術上的優(yōu)勢 [4]。但是總存在著買賣糾紛困擾著行業(yè)的發(fā)展。 introduces the ultra high speed integrated circuit hardware description language is designed and the main functions. In this paper, the main application of the programmable logic chip EPM7128S as the core control, some additional external circuit taxi meter system, with the use of transplantation and strong features, easy to upgrade and repeated use of VHDL language design Key Words: CPLD, VHDL, Taxi fare Registers 1 課題背景 隨著城市的發(fā)展,出租車行業(yè)發(fā)展迅速,出租車的附屬品也應運而生。 the CPLD structure principle and its main application。 出租車行業(yè)以低價高質(zhì)的服務給人們帶來了出行的享受。這些都暴露了傳統(tǒng)計費器靈活性和升級換代能力的不足 [3]。其輸出結構是可編程的邏輯 宏單元 ,因為它的硬件結構設計可由 軟件 完成,因而它的設計比純硬件的數(shù)字電路具有很強的靈活性,但其過于簡單的結構也使它們只能實現(xiàn)規(guī)模較小的電路。幾乎所有應用中小規(guī)模通用 數(shù)字集成電路 的場合均可應用 CPLD 器件。車費顯示出來,有一位小數(shù)。通過對速度信號 sp的判斷決定是否開始記錄時間。同時由t 對 clk 進行計數(shù),當 t 等于 kinside 時,把 clkout 信號置 1, t 清 0。當時間達到足夠長時,產(chǎn)生 timecount 脈沖,并重新計時。最終輸出為總費用。當按下鍵后,清零部分和啟動計費部分同時進行,但清零只是瞬間的,計 費指示燈兩起。圖中,當復位信號 reset 為高電平時,系統(tǒng)所有寄存器、計數(shù)器都清零;當開始計費信號 start 信號有效時,計費器開始計費,根據(jù)出租車行駛的速度 sp[2..0]的取值計算所用花費和行駛里程;當停止計費信號有效時,計費器停止工作。當 reset 信號有效時,系統(tǒng)復位清零;否則,當計時計費信號 timecount 和計程計費信號 clkout 為高電平時,按照一定計費規(guī)則進行計費。未來基于 CPLD 平臺的出租車計費器將會有更低的成本、更小的體積、更安全、更精確和更多功能。 reset:in std_logic。 variable t:integer range 0 to 28。 第五檔 when110=kinside:=8。139。 end if。 clkout=39。 end process。 stop :in std_logic。139。 if start=39。 end if。139。 end if。 kmt2:out std_logic_vector(3 downto 0)。event and clkout=39。 kmt3=km_reg(11 downto 8)。 timecount:in std_logic。 architecture rtl of kmmoney is signal cash:std_logic_vector(11 downto 0)。 else enable=39。then cash=000000000011。 if reg2(7 downto 4)1001then cash=reg2+000001100000。139。 else cash=reg2+price。 總費用的個位 count2=cash(7 downto 4)。 stop :in std_logic。 end top。 ponent times is 定義計時模塊 port( clk :in std_logic。 kmt1:out std_logic_vector(3 downto 0)。 kmt2 :in std_logic_vector(3 downto 0)。 signal kmtmp2 :std_logic_vector(3 downto 0)。 end rtl。 U3:kilometers PORT MAP(clktmp,reset,kmt1,kmtmp2,kmtmp3)。 count3 :out std_logic_vector(3 downto 0) )。 ponent kmmoney is 定義計費模塊 port( clk :in std_logic。 sp :in std_logic_vector(2 downto 0)。 stop :in std_logic。 kmt3:out std_logic_vector(3 downto 0)。 use 。 end if。reg2(3 downto 0)+price(3 downto 0)00001001then reg2(7 downto 0):= 十位進位 reg2(7 downto 0)+00000110+price。 end if。then 判斷是否需要時間計費,每 20s 加一元 if timecount=39。 kmmoney2:process(reset,clkout,clk,enable,price,kmt2) variable reg2:std_logic_vector(11 downto 0)。 else price=0100。 count1 :out std_logic_vector(3 downto 0)。 加載庫文件 use 。 end if。 begin if reset=39。 加載庫文件 use 。039。 if waittime=1000 then timecount=39。 end if。139。 architecture rtl of times is begin process(reset,clk,sp,stop,start) 啟動進程 15 type state_type is(t0,t1,t2)。 use 。 s_state:=s1。139。 if start=39。1