EDA出租车计价器设计.docx

上传人:b****3 文档编号:5356924 上传时间:2022-12-15 格式:DOCX 页数:14 大小:77.29KB
下载 相关 举报
EDA出租车计价器设计.docx_第1页
第1页 / 共14页
EDA出租车计价器设计.docx_第2页
第2页 / 共14页
EDA出租车计价器设计.docx_第3页
第3页 / 共14页
EDA出租车计价器设计.docx_第4页
第4页 / 共14页
EDA出租车计价器设计.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

EDA出租车计价器设计.docx

《EDA出租车计价器设计.docx》由会员分享,可在线阅读,更多相关《EDA出租车计价器设计.docx(14页珍藏版)》请在冰豆网上搜索。

EDA出租车计价器设计.docx

EDA出租车计价器设计

信息技术学院

《可编程逻辑器件原理及应用》课程

综合设计报告书

 

姓名:

王云鹏

班级:

B1106

学号:

0915110601

时间:

2013.12.3

指导教师:

李海成

设计

题目

出租车计价器系统设计

1.能实现计费功能,计费标准为:

按行驶里程收费,起步为5.00元,并在车行5公里后再按1.2元/公里。

2.传感器输出脉冲为0.5m/个。

每0.5km改变一次显示,且提前显示。

3.实现预置功能:

能预置起步费、每公里收费、车行加费里程。

4.实现模拟功能:

能模拟汽车启动、停止等状态。

5.设计动态扫描电路:

将车费显示出来,有两位小数。

6.用VHDL语言设计符合上述功能要求的出租车计费器,并用层次化设计方法设计该电路。

7.各计数器的计数状态用功能仿真的方法验证,并通过有关波形确认电路设计是否正确。

8.完成电路全部设计后,通过系统实验箱下载验证设计的正确性。

 

 

 

 

 

 

 

 

一、实验平台

(1)硬件:

计算机、EDA实验箱;

(2)软件:

MAX+plusII10.0;

(3)编写程序后,并在MAX+plusII10.0工具平台中进行编译、综合、适配、仿真下载到EDA实验箱进行验证,通过LED显示来观察结果。

二、实验原理

(1)控制模块

(2)分频模块

(3)计费动态显示模块

其初值为5元,当里程超过5公里后才接受计数控制模块发出的脉冲的驱动,并且计数显示动态显示出来。

三、出租车计费系统的实现

3.1系统的总体模块图:

四、实验步骤

1、建立工作库文件夹和编辑设计文件

2、程序清单和波形图:

libraryieee;

useieee.std_logic_1164.all;

entitybcd_decoderis

port(bcd:

instd_logic_vector(4downto0);

ledseg:

outstd_logic_vector(7downto0));

endbcd_decoder;

architecturebehaviorofbcd_decoderis

begin

process(bcd)

begin

casebcdis

when"00000"=>ledseg<="00111111";

when"00001"=>ledseg<="00000110";

when"00010"=>ledseg<="01011011";

when"00011"=>ledseg<="01001111";

when"00100"=>ledseg<="01100110";

when"00101"=>ledseg<="01101101";

when"00110"=>ledseg<="01111101";

when"00111"=>ledseg<="00000111";

when"01000"=>ledseg<="01111111";

when"01001"=>ledseg<="01101111";

when"10000"=>ledseg<="10111111";

when"10001"=>ledseg<="10000110";

when"10010"=>ledseg<="11011011";

when"10011"=>ledseg<="11001111";

when"10100"=>ledseg<="11100110";

when"10101"=>ledseg<="11101101";

when"10110"=>ledseg<="11111101";

when"10111"=>ledseg<="10000111";

when"11000"=>ledseg<="11111111";

when"11001"=>ledseg<="11101111";

whenothers=>ledseg<="00000000";

endcase;

endprocess;

endbehavior;

libraryieee;

useieee.std_logic_1164.all;

entitymux41is

port(a,b,c,d:

instd_logic_vector(4downto0);

sel:

instd_logic_vector(1downto0);

y:

outstd_logic_vector(4downto0));

endmux41;

architectureoneofmux41is

begin

process(a,b,c,d,sel)

begin

caseselis

when"00"=>y<=a;

when"01"=>y<=b;

when"10"=>y<=c;

when"11"=>y<=d;

whenothers=>null;

endcase;

endprocess;

endone;

libraryieee;---计程控制

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitykilois

port(clk:

instd_logic;

start:

instd_logic;

stop:

instd_logic;

k1:

outstd_logic_vector(3downto0);

k2:

outstd_logic_vector(3downto0);

k3:

outstd_logic_vector(3downto0);

cn:

outstd_logic);

endkilo;

architecturebehavofkilois

begin

process(clk,start,stop)

variablek_v:

std_logic_vector(11downto0);

begin

ifstop='1'thenk_v:

=(others=>'0');

elsifclk'eventandclk='1'then

ifstart='1'then

ifk_v(3downto0)="1001"then

k_v:

=k_v+"0111";

elsek_v(3downto0):

=k_v(3downto0)+1;

endif;

ifk_v(7downto4)="1010"then

k_v:

=k_v+"01100000";

endif;

endif;

endif;

ifk_v(11downto0)>="000001010000"thencn<='1';elsecn<='0';

endif;

k1<=k_v(3downto0);

k2<=k_v(7downto4);

k3<=k_v(11downto8);

endprocess;

endbehav;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityfenpin100is

port(clk:

instd_logic;

co:

outstd_logic);

constantd:

integer:

=50;

end;

architecturew1offenpin100is

begin

process(clk)

variableq:

std_logic_vector(7downto0);

begin

ifclk'eventandclk='1'then

ifq=d-1thenq:

=(others=>'0');co<='1';

elseq:

=q+1;co<='0';

endif;

endif;

endprocess;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitydianis

port(a:

instd_logic_vector(3downto0);

e:

outstd_logic);

enddian;

architecturert1ofdianis

begin

process

begin

caseais

when"0001"=>e<='1';

when"0101"=>e<='1';

whenothers=>e<='0';

endcase;

endprocess;

endrt1;

libraryieee;--零位

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycounter110is

port(clk:

instd_logic;

en:

instd_logic;

rest:

instd_logic;

cq:

outstd_logic_vector(4downto0);

cout:

outstd_logic);

endcounter110;

architecturebehavofcounter110is

begin

process(clk,rest,en)

variablecqi:

std_logic_vector(4downto0);

begin

ifrest='1'thencqi:

=(others=>'0');cout<='0';

elsifclk'eventandclk='1'then

ifen='1'then

ifcqi<9thencqi:

=cqi+6;cout<='0';

endif;

ifcqi>=9thencout<='1';cqi:

=cqi-"01010";

endif;

endif;

endif;

cq<=cqi;

endprocess;

endbehav;

libraryieee;--十位

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycounter10is

port(clk:

instd_logic;

en:

instd_logic;

rest:

instd_logic;

cq:

outstd_logic_vector(4downto0);

cout:

outstd_logic);

endcounter10;

architecturebehavofcounter10is

begin

process(clk,rest,en)

variablecqi:

std_logic_vector(4downto0);

begin

ifrest='1'thencqi:

=(others=>'0');

elsifclk'eventandclk='1'then

ifen='1'then

ifcqi<9thencqi:

=cqi+1;

elsecqi:

=(others=>'0');

endif;

ifcqi=9thencout<='1';

elsecout<='0';

endif;

endif;

endif;

cq<=cqi;

endprocess;

endbehav;

libraryieee;--个位

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycounter_10is

port(clk:

instd_logic;

en:

instd_logic;

rest:

instd_logic;

cn:

instd_logic;

cq:

outstd_logic_vector(4downto0);

cout:

outstd_logic);

endcounter_10;

architecturebehavofcounter_10is

begin

process(clk,rest,en,cn)

variablecqi:

std_logic_vector(4downto0);

begin

ifrest='1'thencqi:

=(others=>'0');

elsifclk'eventandclk='1'then

ifcn='0'thencqi:

="00101";

elsifen='1'then

ifcqi<=9thencqi:

=cqi+1;

elsecqi:

=(others=>'0');

endif;

ifcqi=10thencout<='1';cqi:

="00000";

elsecout<='0';

endif;

endif;

endif;

cq<=cqi+"10000";

endprocess;

endbehav;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycnt4is

port(clk:

instd_logic;

q:

outstd_logic_vector(1downto0));

endcnt4;

architectureaofcnt4is

begin

process(clk)

variablea:

std_logic_vector(1downto0);

begin

ifclk'eventandclk='1'then

ifa="10"then

a:

="00";

else

a:

=a+1;

endif;

endif;

q<=a;

endprocess;

enda;

五、编译过程

(1)输入完程序之后逐个编译;

(2)逐个编译无错之后进行全程编译;

六、实验小结

这次课程设计中,我们主要是运用VHDL语言设计了一个出租车计费器,并且用层次化的设计方法来实现这个电路。

在程序编写结束后,我们还对该程序进行了调试,能按预期的效果进行模拟汽车启动、停止等功能,基本完成课程设计的

要求。

通过此次课程设计,我们更进一步的深入了解了VHDL设计语言,并通过使用对它有了更深的体会。

对于编程过程中可能遇到的问题有了一定的了解,也明白了其中的一些注意事项,对于下次进行编程设计有很大的帮助和提高。

总之,这次实验不仅仅加强了我的动手编程能力,也大大加强了团队合作以及设计能力,使我在理论学习和编程练习方面都获得了较大的收获。

 

成绩

评定

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1