基于VHDL的出租车计价器设计_---出租车计价器论文答辩精品
出租车计价器论文答辩ppt课件

由仿真结果可以看出此模 块为分频器,当车辆运行
进行8分频,以作为选通脉冲, 时,对输入脉冲cp_32M
使得数码管显示能比较稳定的为 进行分频输出,其中sec是
人眼所看到。
32分频输出信号,
设计采用的输入脉冲为32MHz。 cp_xuan为10分频输出信
号。
.
14
七、总体电路的结果验证
由仿真结果可以得出本设计功能都得以实现,当车辆开始营 运(rst为“0”,stard为“1”)时,对路程脉冲(clk1) 进行计数,同时把行驶的路程和暂停等候时间(由输入的 32MHz脉冲生成分频秒脉冲计来时)均折算成费用,通过选 通模块和译码模块把数据轮流传输到外接的显示设备(共阴 数码管)上。以方便乘客直观的知晓目前的行驶里程和相应 的费用。
.
由仿真结果可知车辆启动后,有 秒脉冲clk2输入该模块。当行驶 路程小于3公里或计费不超过10 元时(即p为“0”),等待时间 不折算成费用。随着行驶路程变 长,超出起步路程或价格后(即 p为“1”),车辆每暂停等待3 分钟,费用增加0.5元。当车辆 停止(即rst为“1”)时,模块 数据清零,车辆开始运行(即rst 为“0”,start为“0”)时, 数据清零。
块输出p信号。
当车辆停止(即rst为“1”)
时,模块数据清零,车辆开始
运行,但还未开始计价(即
rst为“0”,start为“0”)
. 时,预置初始值,起步价17 0
六、模块介绍
2、模块jijia
在出租车营运过程中,必然会 遇到等红灯、堵车等情况,当 车速低于一定值是,此模块开 始工作,把等候时间折算成费 用。
基于VHDL的出租车 计价器设计
Rental car fare register system design base on
基于VHDL的出租车计价器的设计

目录一概述 (1)二总体设计 (2)2.1 设计要求 (2)2.2 设计思路 (2)2.3 设计流程图 (2)三系统仿真结果及分析 (4)仿真波形图分析 (4)四总结及体会 (7)参考文献 (8)附录(程序源代码) (9)一概述随着我国国民经济生产总值的增加以及人民生活水平的提高,各大中小城市的出租车营运事业发展迅速,出租车已经成为人们日常出行选择较为普通的交通工具。
出租车计价器是出租车营运收费的专用智能化仪表,是使出租车市场规范化、标准化的重要设备。
一种功能完备,简单易用,计量准确的出租车计价器是加强出租车行业管理,提高服务质量的必需品。
本设计采用VHDL硬件描述语言作为设计手段,采用自顶向下的设计思路,得到一种出租车计价系统的软件结构,通过QuartusⅡ软件下进行仿真,证明所设计的电路系统完成了出租车计价的功能,各项指标符合设计要求。
该设计虽然功能简单,智能化水平比较低,但仍具有一定的实用性。
该设计是在VHDL的基础上对出租车计价器进行设计来实现其基本功能的,与以往的基于单片机的数模混合电路相比,FPGA具有稳定性好、抗干扰能力强、电路实现简单、程序简单等优点,且非常适合做为出租车计价器的控制核心,所以选择用VHDL来对计价器进行设计来实现其功能。
出租车计价器的实现将大大改善人们出行时因为讨价还价而带来的烦恼,从而使人们的心情比较愉悦。
本设计是对出租车计价器的四个模块进行分析的,综述如下:分频模块:分频模块是其它模块的基础,输入时钟选为32Hz,分频后的时钟频率为1Hz,为后续模块提供基本时钟。
等待时间模块:该模块针对乘客确认下车前的等待而言,比如堵车、中途下车的情况,通过1Hz脉冲计数,每一分钟计时加一,最大计时时间显示为99分钟。
路程模块:该模块是对车辆行驶路程进行计数,以1Hz时钟为基础,检测行程脉冲,路程模块中有内部变量来判断路程,当大于3公里、20公里时,分别有相应的使能信号对此作出记录,最大路程显示为99公里。
基于VHDL的出租车计价器系统设计ppt

end if; end process p1; p2:process (temp0,clkin) begin if (reset='0') then temp1<=(others=>'0'); elsif rising_edge (clkin) then if (temp0>=licheng) then if (temp1=conv_std_logic_vector (4,4)) then temp1<=(others=>'0'); else temp1<=temp1+'1'; end if; end if; end if; end process p2; clkout<='1' when (temp1=conv_std_logic_vector( 4,4)) else '0'; length<="000000"& licheng when(temp0<=licheng) else temp0; end behave;
里程计价部分( 第一部分 里程计价部分(续)
•计数器B作用 •对输入的100m脉冲oclk进行累加 •在开始时输出起步里程数据,而当超出 起步里程时自动输出实际公里数据给译 码/动态扫描模块 •每计满500m路程送出1个脉冲clkout给 计数器C。
里程计价部分( 第一部分 里程计价部分(续) LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; USE ieee.std_logic_arith.ALL; ENTITY cnt_B is port ( reset,clkin: in std_logic; dip:in std_logic_vector (2 downto 0); length:out std_logic_vector(12 downto 0); clkout:out std_logic); end cnt_B; ARCHITECTURE behave of cnt_B is signal licheng: std_logic_vector(6 downto 0); signal temp0: std_logic_vector(12 downto 0); signal temp1:
基于VHDL的出租车计费器设计毕业论文

2.1 系统设计要求
系统设计要求为:
(1)起步价为8.00元,起步公里为3公里;
(2)超过3公里,每公里按1.00元收费;
(3)单程行驶里程超过20公里,每公里租价加收50%;
(4)等候时间累计1分钟,则每分钟折算1公里里程价。
要求显示里程、计费及等候时间。
乘客上车后,按下启动键,开始计费,除非同一乘客往返乘车,否则按下单程键,这样当行驶里程超过20公里时,每公里收费1.5元。
3 出租车计费器的实现
3.1 出租车计费器的顶层原理图
图2顶层原理图
原理图中输入部分分别是clk:系统时钟信号;mile:公里脉冲信号;single:单程键;start:计费器启动信号;stop:等待信号。输出部分为七段译码show和位选码sel,show显示出来的是等候时间、里程和计费。
描述系统顶层实体的VHDL程序见附录。
(4)强大的硬件描述能力。VHDL可以描述系统级电路和门级电路,而且描述方式多样,可以采用行为描述、寄存器传输描述或者结构描述,也可以用其混合描述方式。同时,VHDL可以准确地建立硬件电路模型,因为它支持惯性延迟和传输延迟。VHDL的数据类型很丰富,支持标准定义的数据类型,当标准定义的数据类型不能满足用户的需求时,用户可以自己定义的所需要的数据类型,增加了设计的自由度。
(2)与具体器件无关。用VHDL设计硬件电路时不用先确定设计要用到哪种器件,也不用特别熟悉器件的内部结构,这样可以使设计人员专注于进行系统设计。设计完成后,可以根据消耗的资源选择合适的器件,而不造成资源的浪费。
(3)很强的移植能力。VHDL由很多不同的工具支持,同一个设计的程序可以在包括综合工具、仿真工具、系统平台等工具中使用。
基于VHDL语言的出租车计价器的设计

汽车计价器是乘客与司机双方的交易准则,它是出租车行业发展的重要标志,是出租车最重要的工具。
它关系着双方的利益。
具有良好的性能的计价器无疑是对广大出租车司机朋友还是乘客来说都是很重要的。
因此,汽车计价器的研究也是十分有应用价值的。
随着生活水平的提高,人们已不再满足于衣食住的享受,出行的舒适已受到越来越多人的关注。
于是,出租车行业以低价高质的服务给人们带来了出行的享受。
但是总存在着买卖纠纷困扰着行业的发展。
而在出租车行业中解决这一矛盾的最好方法就是改良计价器。
用更加精良的计价器来为乘客提供更加方便快捷的服务。
我国在70年代开始出现出租车,但那时的计费系统大都是国外进口的,不但不不够准确,而且价格还十分昂贵。
随着改革开放的日益深入,出租车行业的发展势头已十分突出,国内各机械厂纷纷推出国产计价器。
刚开始出租车计价器的功能从刚才开始的只显示路程,到能够自主计费,以及现在能够打印发票和语音提示、按时间自主变动单价等功能。
随着旅游业的发展,出租车行业已成为城市的窗口,象征着一个城市的文明程度。
本设计就是采用VHDL硬件描述语言作为设计手段,采用自顶向下的设计思路,得到出租车计价系统的硬件结构,通过Quartus II 7.2软件下进行设计、仿真,再在EDA试验箱进行硬件仿真,使各项指标符合设计要求,具有一定的实用性。
虽然以前有基于数字电路、单片机进行的出租车计价器的设计,但用数字电路设计的整体电路规模较大,所用的器件较多,造成故障率高,导致计价器不够准确;而基于单片机的设计,虽然开发成本降低,但其外围电路较多,而且调试复杂,抗干扰能力差,从而也导致计价器不够准确。
而基于VHDL语言的FPGA 芯片稳定性好,抗干扰能力强,外围电路少,执行速度快,适合像出租车计价器的这种较复杂的电路设计。
2.1 设计要求设计一种出租车计价器,计费标准如下:(1)起步价8.00元,起步公里为3公里;(2)超过三公里,每公里按1.00元收费;(3)单程行驶里程超过20公里。
基于VHDL语言的出租车计费系统设计

基于VHDL 语言的出租车计费系统设计席砺莼,董丽梅,田梦周,闫宏伟(河北大学电子信息工程学院 河北保定 071002)摘 要:利用V HD L 语言设计出租车计费系统,使其实现计费以及预置和模拟汽车启动、停止、暂停等功能,并设计动态扫描电路显示车费数目,突出了其作为硬件描述语言的良好的可读性、可移植性和易理解等优点。
此程序通过下载到特定芯片后,可应用于实际的出租车计费系统中。
关键词:超高速集成电路硬件描述语言;计数器;M A X +PL U S Ⅱ;高速集成电路中图分类号:T P 29 文献标识码:B 文章编号:1004373X (2003)0307903Design of Taxi Accounting System Based on VHDLX I L ichun ,DON G L imei ,T IA N M engzhou ,YA N Hong weiCo llege of Electro nics &Inf ormat i o n Engineering ,Hebei Universi t y ,Bao ding ,071002,China )Abstract :T he tax i accounting sy stem ba sed on V HD L includes the desig n o f t he ta riff so ftwa re ,the preset and simulatio n o f the car ′s functio ns such as start ,sto p ,pause and so on .I t display s the tar iff number thr oug h the dynamic scanning cir cuit .T he design o f this sy st em has show n the r eadability ,por tability and easily under standing o f V HDL as a hard descr ibe languag e .T he pro gr am can be used in t he truly tax i acco unting system by do wnloading t o the g iven chip.Keywords :V HDL ;co unter ;M AX +PL U S Ⅱ;VHSIC收稿日期:200210281 前言目前,电子系统正向集成化、大规模和高速度的方向发展,集成电路的规模越来越大,复杂程度越来越高,因此传统的门级描述方法显得过于琐碎,难以理解掌握。
基于VHDL_的出租车计费器的设计

基于VHDL 的出租车计费器的设计目前以硬件描述语言(Verilog 或VHDL)所完成的电路设计,可以经过简单的综合与布局,快速的烧录至FPGA 上进行测试,是现代IC 设计验证的技术主流。
这些可编辑元件可以被用来实现一些基本的逻辑门电路(比如AND、OR、XOR、NOT)或者更复杂一些的组合功能比如解码器或数学方程式。
在大多数的FPGA里面,这些可编辑的元件里也包含记忆元件例如触发器(Flip-flop)或者其他更加完整的记忆块。
系统设计师可以根据需要通过可编辑的连接把FPGA内部的逻辑块连接起来,就好像一个电路试验板被放在了一个芯片里。
一个出厂后的成品FPGA的逻辑块和连接可以按照设计者而改变,所以FPGA可以完成所需要的逻辑功能。
本设计是一种采用FPGA芯片进行出租车计费器,主要分为分频模块、计量模块、计费模块、控制模块等模块,利用FPGA的可编程性,简洁又多变的设计方法,缩短了研发周期。
主要采用了FPGA芯片,使用VHDL语言进行编程,使其具有了更强的移植性,更加利于产品的升级。
一、设计任务与要求(1)、能够实现计费功能费用的计算是按行驶里程收费,设出租车的起步价是5.00元,当里程小于3km里时,按起步价收费;当里程大于3km时每公里按1.3元计费。
等待累计时间超过2min,按每分钟1.5元计费。
所以总费用按下式计算:总费用=起步价+(里程-3km)*里程单价+等候时间*等候单价(2)、能够实现显示功能●显示汽车行驶里程:用四位数字显示,显示方式为“XXXX”,单价为km。
计程范围为0~99km,计程分辨率为1km。
●显示等候时间:用两位数字显示分钟,显示方式为“XX”。
计时范围为0~59min,计时分辨率为1min。
●显示总费用:用四位数字显示,显示方式为“XXX.X”,单位为元。
计价范围为999.9元,计价分辨率为0.1元。
二、设计原理根据设计要求,系统的输入信号clk,计价开始信号Start,等待信号Stop,里程脉冲信号fin。
基于VHDL语言的出租车计价器

(基于VHDL语言)出租车计价器自己做的大作业经过测试完全通过,不过里面的时间脉冲以及里程脉冲的时钟信号都比较难搞,不过可以修改其中的值来满足你们提供的时钟脉冲题目要求:(1)行程3公里内(包括3公里),且等待累计时间2分钟内(包括2分钟),起步费为10元;(2)3公里外(不包括3公里)以每公里2元,等待累计时间2分钟外(不包括2分钟)以每分钟以1.0元计费;(3)能显示行驶公里数、等待累计时间和最后的总费用;(4)本计费器的显示范围为0~99元,计价分辨率为1元;计程器显示范围为0~99公里,分辨率为1公里;计时器的显示范围是分钟的显示范围是0—99,分辨率为1分钟。
秒的显示范围是0—59。
分辨率为1秒本出租车计价器的设计共分4个模块:判断模块、时间模块、里程模块、计费模块。
总的设计图如图1所示:计价开始控制判断模块library ieee;use ieee.std_logic_1164.all;--entity judge isport(sclk,sta,lclk: in std_logic;dge: out std_logic);end;architecture beh of judge isbeginprocess(sta,lclk,sclk)variable a: integer range 0 to 64;beginif sta='1' thenif lclk'event and lclk='1' thena:=a+1;end if;if sclk'event and sclk='1' thenif a=0 thendge<='0';--shijian processelsedge<='1';--licheng processend if;end if;if sclk='1' thena:=0;end if;elsedge<='Z';end if;end process;end;时间模块library ieee;use ieee.std_logic_1164.all;--entity time_count isport(sta,sclk,dge: in std_logic;t_count: out std_logic;minge: out integer range 0 to 10;minshi: out integer range 0 to 10); end;--architecture beh of time_count is beginprocess(sta,sclk,dge)variable count: integer range 0 to 60; variable ge: integer range 0 to 10; variable shi: integer range 0 to 10; variable t_c: std_logic;beginif sta='1' thenif dge='0' thenif sclk'event and sclk='1' then count:=count+1;if count=1 thent_c:='0';end if;if count=60 thencount:=0;ge:=ge+1;if ge>2 thent_c:='1';elsif ge>0 thent_c:='1';end if;if ge=10 thenge:=0;shi:=shi+1;if shi=10 thenshi:=0;end if;end if;end if;end if;end if;elsege:=0;shi:=0;t_c:='0';end if;minge<=ge;minshi<=shi;t_count<=t_c;end process;end;里程模块library ieee;use ieee.std_logic_1164.all; --entity time_count isport(sta,sclk,dge: in std_logic;t_count: out std_logic;minge: out integer range 0 to 10;minshi: out integer range 0 to 10); end;--architecture beh of time_count is beginprocess(sta,sclk,dge)variable count: integer range 0 to 60; variable ge: integer range 0 to 10; variable shi: integer range 0 to 10; variable t_c: std_logic;beginif sta='1' thenif dge='0' thenif sclk'event and sclk='1' then count:=count+1;if count=1 thent_c:='0';end if;if count=60 thencount:=0;ge:=ge+1;if ge>2 thent_c:='1';elsif ge>0 thent_c:='1';end if;if ge=10 thenge:=0;shi:=shi+1;if shi=10 thenshi:=0;end if;end if;end if;end if;end if;elsege:=0;shi:=0;t_c:='0';end if;minge<=ge;minshi<=shi;t_count<=t_c;end process;end;计费模块library ieee;use ieee.std_logic_1164.all;--entity price_count isport(sta,t_count,d_count: in std_logic;mge,mshi: out integer range 0 to 10); end;--architecture beh of price_count issignal t_ge,t_shi: integer range 0 to 10; signal d_ge,d_shi: integer range 0 to 10; begin--process(sta,t_count)variable tshi: integer range 0 to 10:=1; variable tge: integer range 0 to 10;beginif sta='1' thenif t_count'event and t_count='1' then tge:=tge+1;if tge=10 thentge:=0;tshi:=tshi+1;if tshi=10 thentshi:=0;end if;end if;end if;elsetge:=0;tshi:=1;end if;t_ge<=tge;t_shi<=tshi;end process;--process(sta,d_count)variable dge,dshi: integer range 0 to 10; beginif sta='1' thenif d_count'event and d_count='1' then dge:=dge+2;if dge=10 thendge:=0;dshi:=dshi+1;if dshi=10 thendshi:=0;end if;end if;end if;elsedge:=0;dshi:=0;end if;d_ge<=dge;d_shi<=dshi;end process;--process(d_ge,d_shi,t_ge,t_shi) variable cge: integer range 0 to 1; variable ge,shi:integer range 0 to 10; beginge:=d_ge+t_ge;if ge>=10 thenge:=ge-10;cge:=1;elsecge:=0;end if;shi:=d_shi+t_shi+cge;mge<=ge;mshi<=shi;end process;end;显示模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity display isport(CLK:in std_logic;sminge,sminshi: in integer range 0 to 10;skmge,skmshi: in integer range 0 to 10;smge,smshi: in integer range 0 to 10;weixuan:OUT std_logic_vector(2 downto 0);seg:out std_logic_vector(7 downto 0)); end;architecture one of display issignal cnt1:std_logic_vector(22 downto 0);signal S:std_logic_vector(2 downto 0);signal sel:std_logic_vector(2 downto 0);beginprocess(CLK)beginif CLK'event and CLK='1' THEN cnt1<=cnt1+1;end if;END PROCESS;S<=cnt1(5 downto 3);--300hzsel<="000" when S="000" else"001" when S="001" else"010" when S="010" else"011" when S="011" else"100" when S="100" else"101" when S="101" else"110" when S="110" else"111" when S="111" else"ZZZ";weixuan<=sel;process(sel,sminshi,sminge,skmshi,skmge,smshi,smge) variable num:integer range 0 to 10;begincase sel ISwhen"000"=>num:=sminge;when"001"=>num:=sminshi;when"011"=>num:=skmge;when"100"=>num:=skmshi;when"110"=>num:=smge;when"111"=>num:=smshi;when others=>num:=0;end case;case num ISwhen 0=>seg<="00111111";when 1=>seg<="00000110";when 2=>seg<="01011011";when 3=>seg<="01001111";when 4=>seg<="01100110";when 5=>seg<="01101101";when 6=>seg<="01111101";when 7=>seg<="00000111";when 8=>seg<="01111111";when 9=>seg<="01101111";when others=>seg<="00000000";end case;end process;end one;元件例化模块library ieee;use ieee.std_logic_1164.all;--entity comp isport(sclk,lclk,sta,dclk: in std_logic;weixuan:OUT std_logic_vector(2 downto 0);seg:out std_logic_vector(7 downto 0)); end;--architecture beh of comp is--component judge isport(sclk,sta,lclk: in std_logic;dge: out std_logic);end component;--component time_count isport(sta,sclk,dge: in std_logic;t_count: out std_logic;minge: out integer range 0 to 10;minshi: out integer range 0 to 10);end component;--component distance_count isport( sta,lclk,dge: in std_logic;kmge,kmshi: out integer range 0 to 10;d_count: out std_logic);end component;--component price_count isport(sta,t_count,d_count: in std_logic;mge,mshi: out integer range 0 to 10);end component;--component display isport(CLK:in std_logic;sminge,sminshi: in integer range 0 to 10;skmge,skmshi: in integer range 0 to 10;smge,smshi: in integer range 0 to 10;weixuan:OUT std_logic_vector(2 downto 0);seg:out std_logic_vector(7 downto 0));end component;--signal w,x,y: std_logic;signal time_ge,time_shi:integer range 0 to 10;signal pri_ge,pri_shi:integer range 0 to 10;signal dis_ge,dis_shi:integer range 0 to 10;--beginU1: judge port map(sta=>sta,sclk=>sclk,lclk=>lclk,dge=>w);U2: time_count port map(sta=>sta,sclk=>sclk,dge=>w,t_count=>x,minge=>time_ge,minshi=>time_shi);U3: distance_count port map(sta=>sta,lclk=>lclk,dge=>w,d_count=>y,kmge=>dis_ge,kmshi=>dis_shi);U4: price_count port map(sta=>sta,t_count=>x,d_count=>y,mge=>pri_ge,mshi=>pri_shi);U5: display port map(dclk,time_ge,time_shi,dis_ge,dis_shi,pri_ge,pri_shi,weixuan,seg);end;。