




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1.设计背景汽车计价器是乘客与司机双方的交易准则,它是出租车行业发展的重要标志,是出租车最重要的工具。它关系着双方的利益。具有良好的性能的计价器无疑是对广大出租车司机朋友还是乘客来说都是很重要的。因此,汽车计价器的研究也是十分有应用价值的。随着生活水平的提高,人们已不再满足于衣食住的享受,出行的舒适已受到越来越多人的关注。于是,出租车行业以低价高质的服务给人们带来了出行的享受。但是总存在着买卖纠纷困扰着行业的发展。而在出租车行业中解决这一矛盾的最好方法就是改良计价器。用更加精良的计价器来为乘客提供更加方便快捷的服务。我国在70年代开始出现出租车,但那时的计费系统大都是国外进口的,不但不不够准确
2、,而且价格还十分昂贵。随着改革开放的日益深入,出租车行业的发展势头已十分突出,国内各机械厂纷纷推出国产计价器。刚开始出租车计价器的功能从刚才开始的只显示路程,到能够自主计费,以及现在能够打印发票和语音提示、按时间自主变动单价等功能。随着旅游业的发展,出租车行业已成为城市的窗口,象征着一个城市的文明程度。本设计就是采用VHDL硬件描述语言作为设计手段,采用自顶向下的设计思路,得到出租车计价系统的硬件结构,通过Quartus II 7.2软件下进行设计、仿真,再在EDA试验箱进行硬件仿真,使各项指标符合设计要求,具有一定的实用性。虽然以前有基于数字电路、单片机进行的出租车计价器的设计,但用数字电路
3、设计的整体电路规模较大,所用的器件较多,造成故障率高,导致计价器不够准确;而基于单片机的设计,虽然开发成本降低,但其外围电路较多,而且调试复杂,抗干扰能力差,从而也导致计价器不够准确。而基于VHDL语言的FPGA芯片稳定性好,抗干扰能力强,外围电路少,执行速度快,适合像出租车计价器的这种较复杂的电路设计。2.设计原理2.1 设计要求设计一种出租车计价器,计费标准如下:(1) 起步价8.00元,起步公里为3公里;(2) 超过三公里,每公里按1.00元收费;(3) 单程行驶里程超过20公里。每公里租价加收50%;(4) 等候时间累积一分钟,每分钟1.00元;要求显示里程、计费及等候时间。乘客上车后
4、,按下启动键,开始计费,除非同一个乘客往返用哪个车,否则按下单程键,这样行驶里程超过20公里时,每公里加收50%,即每公里租费1.5元;计费显示为3位整数,一位小数。2.2 设计模块2.2.1 总体设计本出租车计价器的设计共分4个模块:判断模块、时间模块、里程模块、计费模块。总的设计图如图1所示:单双程控制判断模块里程模块计费模块时间输出计费输出里程输出秒脉冲输入里程脉冲输入计价开始控制图1.总体设计图时间模块2.2.2 判断模块判断模块主要通过对秒脉冲和里程脉冲进行计数,判断出租车是否停下,然后输出片选信号,选择时间计费还是里程计费。判断模块的模块图如图2所示:判断模块stasclklclk
5、dge图2.判断模块2.2.3 时间模块时间模块是当出租车停下时,对秒脉冲进行计数,从而计算出出租车停下的累积时间,并输出累积时间和计费脉冲。时间模块的模块图如图3所示:时间模块stasclkdget_count图3.时间模块时间输出2.2.4 里程模块里程模块是当出租车行驶的时候,对里程脉冲进行计数,从而算出出租车所行驶的里程,通过对单双程的控制进行不同的计费标准,最后输出行驶里程和计费脉冲。里程模块的模块图如图4所示:里程模块stalclkdged_count图4.里程模块里程输出doub2.2.5 计费模块计费模块stat_countd_count图5.计费模块计费输出计费模块通过对里程
6、计费脉冲和时间计费脉冲分别进行计数,将其换算成价钱并对进行价钱输出。计费模块的模块图如图5所示:3. 仿真结果分析3.1 判断模块的仿真判断模块的仿真结果如图6所示:图6 判断模块的仿真结果3.2 时间模块的仿真时间模块的仿真结果如图7所示:图7 时间模块的仿真结果3.3 里程模块的仿真里程模块的仿真结果如图8所示:图8 里程模块的仿真结果3.4 计费模块的仿真计费模块的仿真结果如图9所示:图9 计费模块的仿真结果 3.5元件例化后的仿真元件例化后的仿真结果如图10所示:图10 元件例化后的仿真结果6.模块的引脚锁定图11 模块的引脚锁定引脚锁定图如图11所示:4. 设计总结在这次对出租车计价
7、器的课程设计实习中,我们充分的应用了所学的知识,通过去图书馆查阅相关资料和上网搜索相关知识,我们颇有收获。由于这次设计比往常设计要复杂,如果将所有功能设计到一个模块中,对于设计和编程都有不小的困难,所以最后我们采用模块化设计,将某些功能设计成一个模块,最后用元件例化将各个模块连接起来,形成一个完整的系统,这种设计方法不仅降低了编程难度,而且使我们的设计更有条理。通过这次设计,我们对模块化设计有了更深的了解。在这次设计中,我们也遇到了许多困难。有些设计虽然在逻辑上成立,但FPGA的硬件结构不能实现这种设计,比如多值驱动问题,上升下降沿问题,像我在设计计费模块的时候,预想的是时间计费脉冲和里程计费
8、脉冲共同来驱动计费计数器,实现计费功能,这种设计很简单,但这种设计会报错。最后只能时间、里程分别计费,然后将费用分别相加,这种设计虽然有点复杂,但并没有报错,而且仿真结果正确。通过这次设计我们更加了解了FPGA的硬件结构,以后设计的时候要注意使用能实现的设计方式。这次设计让我们更加了解了EDA的设计方法,熟悉了模块化的设计思路,对于以后的设计很有帮助。总之,这次设计很有意义。参考文献1 潘松,黄继业. EDA技术使用教程. 科学出版社,2010.62 刘江海. EDA技术课程设计. 华中科技大学出版社,2009.5附录参考程序:1.判断模块library ieee;use ieee.std_l
9、ogic_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' then if lclk'event and lclk='1' then a:=a+1; end if; if sclk'event and sclk='1&
10、#39; then if a=0 then dge<='0'-shijian process else dge<='1'-licheng process end if; end if; if sclk='1' then a:=0; end if;else dge<='Z'end if;end process;end;2.时间模块library ieee;use ieee.std_logic_1164.all;-entity time_count isport(sta,sclk,dge: in std_logic;
11、 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 isbeginprocess(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 s
12、ta='1' thenif dge='0' then if sclk'event and sclk='1' then count:=count+1; if count=1 then t_c:='0' end if; if count=60 then count:=0; ge:=ge+1; t_c:='1' if ge=10 then ge:=0; shi:=shi+1; if shi=10 then shi:=0; end if; end if; end if; end if;end if;else ge:
13、=0; shi:=0; t_c:='0'end if;minge<=ge;minshi<=shi;t_count<=t_c;end process;end;3.里程模块-1500round/km-1.00yuan/km-> per150->+1-1.50yuan/km-> per100->+1library ieee;use ieee.std_logic_1164.all;-entity distance_count isport( sta,lclk,doub,dge: in std_logic; kmfen,kmge,kmshi: o
14、ut integer range 0 to 10; d_count: out std_logic);end;-architecture beh of distance_count isbeginprocess(sta,lclk,doub,dge)variable fen,ge,shi: integer range 0 to 10;variable count: integer range 0 to 150;variable ct: integer range 0 to 150;variable d_c: std_logic;beginif sta='1' thenif dge=
15、'1' then if lclk'event and lclk='1' then ct:=ct+1; count:=count+1; if doub='0' and shi>=2 then -single and licheng>=20km if ct=1 then d_c:='0' end if; if ct=100 then ct:=0; d_c:='1' end if; elsif ge>=3 or shi/=0 then -double or licheng<=20km an
16、d km>3 if ct=1 then d_c:='0' end if; if ct=150 then ct:=0; d_c:='1' end if; else ct:=0; end if; if count=150 then count:=0; fen:=fen+1; if fen=10 then fen:=0; ge:=ge+1; if ge=10 then ge:=0; shi:=shi+1; if shi=10 then shi:=0; end if; end if; end if; end if; end if;end if; else fen:
17、=0; ge:=0; shi:=0; d_c:='0'end if; kmfen<=fen;kmge<=ge;kmshi<=shi;d_count<=d_c;end process;end;4.计费模块library ieee;use ieee.std_logic_1164.all;-entity price_count isport(sta,t_count,d_count: in std_logic; mjiao,mge,mshi,mbai: out integer range 0 to 10);end;-architecture beh of pri
18、ce_count issignal t_ge,t_shi,t_bai: integer range 0 to 10;signal d_ge,d_shi,d_bai: integer range 0 to 10;begin-process(sta,t_count)variable tshi,tbai: integer range 0 to 10;variable tge: integer range 0 to 10:=8;beginif sta='1' then if t_count'event and t_count='1' then tge:=tge+
19、1; if tge=10 then tge:=0; tshi:=tshi+1; if tshi=10 then tshi:=0; tbai:=tbai+1; if tbai=10 then tbai:=0; end if; end if; end if; end if;else tge:=8; tshi:=0; tbai:=0;end if;t_ge<=tge;t_shi<=tshi;t_bai<=tbai;end process;-process(sta,d_count)variable djiao: integer range 0 to 10;variable dge,d
20、shi,dbai: integer range 0 to 10;beginif sta='1' then if d_count'event and d_count='1' then djiao:=djiao+1; if djiao=10 then djiao:=0; dge:=dge+1; if dge=10 then dge:=0; dshi:=dshi+1; if dshi=10 then dshi:=0; dbai:=dbai+1; if dbai=10 then dbai:=0; end if; end if; end if; end if; e
21、nd if;else djiao:=0; dge:=0; dshi:=0; dbai:=0;end if;mjiao<=djiao;d_ge<=dge;d_shi<=dshi;d_bai<=dbai;end process;-process(d_ge,d_shi,d_bai,t_ge,t_shi,t_bai)variable cge,cshi,cbai: integer range 0 to 1;variable ge,shi,bai:integer range 0 to 20;begin ge:=d_ge+t_ge; if ge>=10 then ge:=ge-
22、10; cge:=1; else cge:=0; end if; shi:=d_shi+t_shi+cge; if shi>=10 then shi:=shi-10; cshi:=1; else cshi:=0; end if; bai:=d_bai+t_bai+cshi; if bai>=10 then bai:=bai-10; cbai:=1; else cbai:=0; end if;mge<=ge;mshi<=shi;mbai<=bai;end process;end;5.元件例化library ieee;use ieee.std_logic_1164.a
23、ll;-entity comp is port(sclk,lclk,sta,doub: in std_logic; time_ge,time_shi: out integer range 0 to 10; pri_jiao,pri_ge,pri_shi,pri_bai: out integer range 0 to 10; dis_fen,dis_ge,dis_shi: out integer range 0 to 10);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
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025广西石卡镇储备村(社区)“两委”后备人才152人模拟试卷及答案详解(必刷)
- 2025年台州仙居县卫生健康系统公开招聘卫技人员8人模拟试卷及答案详解(网校专用)
- 2025湖南湘西古丈县教育类事业单位公开引进高层次急需紧缺人才6人模拟试卷及答案详解(考点梳理)
- 2025江苏海事职业技术学院招聘高层次人员28人考前自测高频考点模拟试题参考答案详解
- 2025贵阳农商银行“超享聘·旭日计划”大学生招聘20人考前自测高频考点模拟试题及1套完整答案详解
- 2025年抚松县面向普通高等院校公开招聘高中教师(9人)模拟试卷附答案详解(模拟题)
- 2025年金华磐安县卫健事业单位公开招聘工作人员29人考前自测高频考点模拟试题及1套参考答案详解
- 2025贵州剑河县农村集体经济组织选聘职业经理人(总经理)17人模拟试卷及1套参考答案详解
- 2025辽宁沈阳城市建设投资集团有限公司所属企业沈阳城投新能源集团有限公司招聘7人考前自测高频考点模拟试题及答案详解(各地真题)
- 2025杭州青少年活动中心招聘工勤岗位工作人员20人考前自测高频考点模拟试题及答案详解(全优)
- 《铁在人体中的作用》课件
- 二年级上册道德与法治第一单元《团团圆圆过中秋》作业设计
- 污水井钢板桩支护施工及基坑土方开挖专项方案
- 急救知识试题+参考答案
- 酒店蔬菜供货合同模板
- 【青松雪】几何最值36问-解析版
- 《海底隧道技术讲义》课件
- MOOC 耕作学-沈阳农业大学 中国大学慕课答案
- 《商业文化》课件-第3章 古代商贤及其商业文化
- 小儿结核病教案
- 我的家乡滕州市宣传简介
评论
0/150
提交评论