

已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
上海电力学院课程设计报告课程设计名称: fpga设计实践课程 设计课题名称: 出租车计费器 班级: 2008141 指导老师: 赵倩 姓名: 丁晓亮 学号: 20082614 成绩: 设计时间: 2011-6-277-1 设计地点: 知行楼 303 实验室 计算机信息与工程学院出租车计费器报告一、 设计目的:熟练使用altera quartusii 仿真软件。掌握vhdl硬件描述语言进行硬件编程。理解fpga技术的层次化设计方法。二、 实验器材和工具软件:fpga开发版,quartus ii软件三、 设计内容: l. 能实现计费功能, 计费标准为:按行驶里程收费, 起步费为7.00元, 并在车行3公里后再按2.2元/公里, 当计费器计费达到或超过一定收费(如20元)时, 每公里加收50%的车费,车停止不计费。2. 实现预置功能:能预置起步费、每公里收费、车行加费里程。3. 实现模拟功能:能模拟汽车启动、停止、暂停、车速等状态。4. 设计动态扫描电路:将车费显示出来, 有两位小数。5. 用vhdl语言设计符合上述功能要求的出租车计费器, 并用层次化设计方法设计该电路。6. 各计数器的计数状态用功能仿真的方法验证, 并通过有关波形确认电路设计是否正确。7. 完成电路全部设计后, 通过系统实验箱下载验证设计课题的正确性。四、 设计具体步骤:顶层原理图:工作原理:由工作板上的时钟脉冲通过分频器控制计费模块产生路费和路程的二进制数且最多都为十三位,输入转换模块使路程和路费转换成四个四位输出, 继而通过led转换模块转换成led代码,最终在led显示出来。计费模块原理图:vhdl语言:library ieee;use ieee.std_logic_1164.all;-written by dingxiaoliang on 2011.6.27;2011.7.1use ieee.std_logic_unsigned.all;use ieee.numeric_std.all;entity chuzuche is port(luf3,luf2,luf1,luf0,luc3,luc2,luc1,luc0:buffer std_logic_vector(3 downto 0); clk,start,stop,pause:in std_logic);end chuzuche;architecture behav_chuzuche of chuzuche isbeginprocess(clk,stop,start,pause)variable c1,c2:std_logic;beginif (clk event and clk=1) then if (stop=0) then luf3=0000; luf2=0000; luf1=0000;luf0=0000; luc3=0000; luc2=0000; luc1=0000;luc0=0000; elsif (start=0 and pause=1) then luf3=0000; luf2=0111; luf1=0000;luf0=0000; luc3=0000; luc2=0000; luc1=0000;luc0=0000; elsif (start=1 and pause=1) then luc0=luc0+0001; end if;if luc0=1001 then luc0=0000; luc1=luc1+0001;end if;if luc1=1001 then luc1=0000; luc2=luc2+0001;end if;if luc2=1001 then luc2=0000; luc3=luc3+0001;end if;if luc3=1001 then luc3=0011 or luc2=0001) then -路程超过30 (3000m) if (luf30010) then -路费低于20元if (luf1=1000 and luf0=0110) then luf0=luf0+0010; luf1=0000;c1:=1;elsif(luf1=1000 and luf0=1000) then luf0=0000;luf1=0001;c1:=1; elsif(luf1=0111 and luf0=1000) then luf0=0000;luf1=0000;c1:=1;elsif(luf1=1001 and luf0=0110) then luf0=luf0+0010;luf1=0001;c1:=1;elsif(luf1=1001 and luf0=1000) then luf0=0000;luf1=0010;c1:=1;elsif(luf10111 and luf0=1000) then luf0=0000;luf1=luf1+0011;c1:=0;else luf0=luf0+0010;luf1=luf1+0010;c1:=0; end if; else -路费大于20元if (luf0=0110 and luf1=0111) then luf0=luf0+0011;luf1=0000;c1:=1;elsif(luf0=0110 and luf1=1000) then luf0=luf0+0011;luf1=0001;c1:=1;elsif(luf0=0110 and luf1=1001) then luf0=luf0+0011;luf1=0010;c1:=1;elsif(luf0=0111 and luf1=0101) then luf0=0000 ; luf1=luf1+0100;c1:=0;elsif(luf0=0111 and luf1=0110) then luf0=0000 ;luf1=0000;c1:=1;elsif(luf0=0111 and luf1=0111) then luf0=0000 ;luf1=0001;c1:=1;elsif(luf0=0111 and luf1=1000) then luf0=0000 ; luf1=0010;c1:=1;elsif(luf0=0111 and luf1=1001) then luf0=0000 ; luf1=0011;c1:=1;elsif(luf0=1000 and luf1=0101) then luf0=0001 ; luf1=luf1+0100;c1:=0;elsif(luf0=1000 and luf1=0110) then luf0=0001 ; luf1=0000;c1:=1;elsif(luf0=1000 and luf1=0111) then luf0=0001 ;luf1=0001;c1:=1;elsif(luf0=1000 and luf1=1000) then luf0=0001 ; luf1=0010;c1:=1;elsif(luf0=1000 and luf1=1001) then luf0=0001 ;luf1=0011;c1:=1;elsif(luf0=1001 and luf1=0101) then luf0=0010 ; luf1=luf1+0100;c1:=0;elsif(luf0=1001 and luf1=0110) then luf0=0010; luf1=0000;c1:=1;elsif(luf0=1001 and luf1=0111) then luf0=0010 ; luf1=0001;c1:=1;elsif(luf0=1001 and luf1=1000) then luf0=0010 ; luf1=0010;c1:=1;elsif(luf0=1001 and luf1=1001) then luf0=0010 ; luf1=0011;c1:=1;else luf0=luf0+0011;luf1=luf1+0011;c1:=0;end if; end if;if(luf2=1001 and c1=1) then luf2=0000;c2:=1;elsif(luf2=1000 and c1=1) then luf2=luf2+0001;c2:=0; end if;if(luf3=1001 and c2=1) then luf3=0000;c2:=0;elsif(luf3=1000 and c2=1) then luf3=luf3+0001;c2:=0;end if;end if;end if;end if;end process;end behav_chuzuche;工作原理:由时钟脉冲作用,且各个控制端都为低电平有效,开始起作用,停止,暂停,加速都不起作用时,开始普通的路程累加,路费的预置为7.00元,摁下停止键时,计费与路程全部清零,暂停键时使路程数与路费计数保持,用两个不同频率的时钟脉冲的选择确定车行的速度。当路程累加到3.00公里即3000m时,开始加法计费,每经过0.1公里路费累加0.22元,当车费超过20.00元时按每0.1公里0.33元的费用累加。通过四个二进制输出动态显示车费与路程情况。二选一频率(车速选择)模块:vhdl语言:library ieee;use ieee.std_logic_1164.all; entity xuan1 isport(a,b,c :in std_logic; y:out std_logic);end xuan1;architecture behave_xuan1 of xuan1 is beginwith c selecty=a when 0, b when others;end behave_xuan1;工作原理:当c端所接的为低电平时选择a所对应分频器的输出频率,当c端所接的为高电平时选择b所对应分频器的输出频率。分频模块: vhdl语言:分频器1:library ieee;use ieee.std_logic_1164.all; entity fenpin isport( clkin :in std_logic; clkout:out std_logic);end fenpin; architecture behave_fenpin of fenpin is constant n: integer:=24999999;signal counter:integer range 0 to n;signal clk: std_logic;begin process(clkin) begin if rising_edge(clkin) then if counter=n then counter=0; clk=not clk; else counter= counter+1; end if; end if; end process; clkout= clk;end behave_fenpin;分频器2:library ieee;use ieee.std_logic_1164.all; entity fenpin2 isport( clkin :in std_logic; clkout:out std_logic);end fenpin2; architecture behave_fenpin2 of fenpin2 is constant n: integer:=12499999;signal counter:integer range 0 to n;signal clk: std_logic;begin process(clkin) begin if rising_edge(clkin) then if counter=n then counter=0; clk=not clk; else counter= counter+1; end if; end if; end process; clkout= clk;end behave_fenpin2;工作原理:通过选择不同频率的分频器来实现不同的车速。数码管显示模块:vhdl语言:library ieee;use ieee.std_logic_1164.all;entity xianshi isport(shuru:in std_logic_vector(3 downto 0); shuchu:out std_logic_vector(6 downto 0);end xianshi;architecture behav_xianshi of xianshi isbegin with shuru selectshuchu=1000000 when 0000,-0 1111001 when 0001,-1 0100100 when 0010,-2 0110000 when 0011,-3 0011001 when 0100,-4 0010010 when 0101,-5 0000010 when 0110,-6 1111000 when 0111,-7 0000000 when 1000,-8 0010000 when 1001,-9 1111111 when others;end behav_xianshi;工作原理:将输入的四位二进制数转显示编码显示,共使用八个数码管,通过引脚分配接到数码管上予以显示。仿真波形:五、 设计收获以及存在的问题:在实验中,我收获了许多。通过一个学期的学习我对fpga有了进一步的认识,但是通过本次实验,我将以前所学的各个知识点进行了联系,对于原本课程实验中的一些模块进行了整合
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 玉柴职业技术学院《经济数学上》2023-2024学年第二学期期末试卷
- 成都银杏酒店管理学院《西医外科学医学免疫学与病原生物学》2023-2024学年第二学期期末试卷
- 苏州城市学院《印刷工艺》2023-2024学年第二学期期末试卷
- 广州航海学院《海水养殖生物学》2023-2024学年第二学期期末试卷
- 泉州医学高等专科学校《项目导向专业课程光电检测及无损评估方向》2023-2024学年第二学期期末试卷
- 银川科技学院《食品安全检测》2023-2024学年第二学期期末试卷
- 工业互联网的应用与发展前景
- 工业互联网背景下的智能物流发展
- 工业产品设计中的环保材料应用研究
- 工业互联网与智能制造的关系
- AQ 1097-2014 井工煤矿安全设施设计编制导则(正式版)
- SH/T 3046-2024 石油化工立式圆筒形钢制焊接储罐设计规范(正式版)
- JT∕T 795-2023 事故汽车修复技术规范
- 预防接种门诊验收表4-副本
- 外国文学之旅智慧树知到期末考试答案章节答案2024年山东师范大学
- 驾驶档案注销委托书
- 焊接规范的基本要求
- 广东省广州市2024届七年级生物第二学期期末教学质量检测模拟试题含解析
- 备战中考生物专项练习题-心脏和血液循环(全国通用-含答案)-
- 《国际汉语教师证书》考试汉办真题
- 室内装修工程应急预案范本
评论
0/150
提交评论