EDA 出租汽车计费器文档.docx

上传人:b****5 文档编号:3029761 上传时间:2022-11-17 格式:DOCX 页数:13 大小:141.26KB
下载 相关 举报
EDA 出租汽车计费器文档.docx_第1页
第1页 / 共13页
EDA 出租汽车计费器文档.docx_第2页
第2页 / 共13页
EDA 出租汽车计费器文档.docx_第3页
第3页 / 共13页
EDA 出租汽车计费器文档.docx_第4页
第4页 / 共13页
EDA 出租汽车计费器文档.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

EDA 出租汽车计费器文档.docx

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

EDA 出租汽车计费器文档.docx

EDA出租汽车计费器文档

实验报告

 

课程名称:

EDA技术

实验名称:

出租车计费器

实验类型:

设计学时:

3

系别:

物电院专业:

电子信息工程

年级班别:

开出学期:

2008-2009(上

学生姓名:

学号:

实验教师:

成绩:

 

2008年12月8日

 

出租车计费器

一、实验任务及要求:

1.5Km起计价,起始价5元,每公里1.2元;

2.传感器输出脉冲为0.5Km/个;

3.每0.5km改变一次显示,且提前显示(显示路程和车费),车停止不计费。

4.实现模拟功能:

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

5.设计动态扫描电路:

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

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

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

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

二、实验总体框图:

出租车计费总体框图如图一所示。

它由五个模块组成,JIFEI(计费电路)、TRANS(转换电路)、SE(扫描电路)、XIANSHI(显示电路)、和DI(字形显示电路)。

计费电路完成计费功能;转换电路把车费和路程转换成四位十进制数;显示电路实际上是八选一数据选择器,和扫描电路共同控制输出;字形显示电路输出0~9个字形。

图一总体框图

三、各个模块的VHDL程序与仿真波形如下:

(1)计费模块(计费)

计费模块如图二所示。

输入端口START、JS分别代表启动/停止、加速。

输出端口FARE、DISTANCE代表车费和路程。

(程序中lc、chefei分别代表路程和车费)

 

图二计费模块

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityjifeiis

port(clk,start,js:

instd_logic;

fare,distance:

outintegerrange0to8000);

endjifei;

architectureaaofjifeiis

begin

process(clk,start,js)

variablechefei,lc:

integerrange0to8000;

begin

if(clk'eventandclk='1')then

if(start='0')then

chefei:

=0;

lc:

=0;

elsif(start='1'andjs='0')then

chefei:

=500;

lc:

=0;

endif;

if(start='1'andjs='1')then

lc:

=lc+50;

endif;

if(lc>=500)then

chefei:

=chefei+60;

endif;

endif;

fare<=chefei;

distance<=lc;

endprocess;

endaa;

 

该模块的仿真波形如图二-1所示

图二-1

 

(2)转换模块(TRANS)

转换模块如图三所示。

DCLK的频率要比CLK的快很多。

输入端口ASCORE、BSCORE代表车费和路程,输出端口A0~A3(B0~B3)分别代表车费(路程)的个、十、百、千。

图三转换模块

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_arith.all;

entitytransis

port(dclk:

instd_logic;

ascore,bscore:

inintegerrange0to8000;

a0,a1,a2,a3,b0,b1,b2,b3:

outstd_logic_vector(3downto0));

endtrans;

architecturemixoftransis

signalcom1:

integerrange0to8000;

begin

process(dclk,ascore)

variablecom1a,com1b,com1c,com1d:

std_logic_vector(3downto0);

begin

if(dclk'eventanddclk='1')then

if(com1

if(com1a=9andcom1b=9andcom1c=9)then

com1a:

="0000";

com1b:

="0000";

com1c:

="0000";

com1d:

=com1d+1;

elsif(com1a=9andcom1b=9)then

com1a:

="0000";

com1b:

="0000";

com1c:

=com1c+1;

com1<=com1+1;

elsif(com1a=9)then

com1a:

="0000";

com1b:

=com1b+1;

com1<=com1+1;

else

com1a:

=com1a+1;

com1<=com1+1;

endif;

else

a0<=com1a;

a1<=com1b;

a2<=com1c;

a3<=com1d;

com1<=0;

com1a:

="0000";

com1b:

="0000";

com1c:

="0000";

com1d:

="0000";

endif;

endif;

endprocess;

process(dclk,bscore)

variablecom2:

integerrange0to8000;

variablecom2a,com2b,com2c,com2d:

std_logic_vector(3downto0);

begin

if(dclk'eventanddclk='1')then

if(com2

if(com2a=9andcom2b=9andcom2c=9)then

com2a:

="0000";

com2b:

="0000";

com2c:

="0000";

com2d:

="0000";

com2d:

=com2d+1;

elsif(com2a=9andcom2b=9)then

com2a:

="0000";

com2b:

="0000";

com2c:

=com2c+1;

com2:

=com2+1;

elsif(com2a=9)then

com2a:

="0000";

com2b:

=com2b+1;

com2:

=com2+1;

else

com2a:

=com2a+1;

com2:

=com2+1;

endif;

else

b0<=com2a;

b1<=com2b;

b2<=com2c;

b3<=com2d;

com2:

=0;

com2a:

="0000";

com2b:

="0000";

com2c:

="0000";

com2d:

="0000";

endif;

endif;

endprocess;

endmix;

该模块的仿真波形如图三-1所示

图三-1

(3)显示模块(XIANSHI)

显示模块如图四所示。

图四显示模块

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityxianshiis

port(c:

instd_logic_vector(2downto0);

a0,a1,a2,a3,b0,b1,b2,b3:

instd_logic_vector(3downto0);

dp:

outstd_logic;

d:

outstd_logic_vector(3downto0));

endxianshi;

architecturemixofxianshiis

begin

process(c,a0,a1,a2,a3,b0,b1,b2,b3)

variablecom:

std_logic_vector(2downto0);

begin

com:

=c;

casecomis

when"000"=>d<=a0;dp<='0';

when"001"=>d<=a1;dp<='0';

when"010"=>d<=a2;dp<='1';

when"011"=>d<=a3;dp<='0';

when"100"=>d<=b0;dp<='0';

when"101"=>d<=b1;dp<='0';

when"110"=>d<=b2;dp<='1';

when"111"=>d<=b3;dp<='0';

whenothers=>null;

endcase;

endprocess;

endmix;

该模块的仿真波形如图四-1所示

图四-1

(4)选择模块(SE)

选择模块如图五所示。

图五选择模块

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityseis

port(clk:

instd_logic;

a:

outstd_logic_vector(2downto0));

endse;

architecturemixofseis

begin

process(clk)

variableb:

std_logic_vector(2downto0);

begin

if(clk'eventandclk='1')then

if(b="111")then

b:

="000";

else

b:

=b+1;

endif;

endif;

a<=b;

endprocess;

endmix;

该模块的仿真波形如图五-1所示

图五-1

(5)字形显示模块(DI)

字形显示模块如图六所示。

图六DI模块

 

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitydiis

port(d:

instd_logic_vector(3downto0);

q:

outstd_logic_vector(6downto0));

enddi;

architecturemixofdiis

begin

withdselect

q<="1111110"when"0000",

"0110000"when"0001",

"1101101"when"0010",

"1111001"when"0011",

"0110011"when"0100

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

当前位置:首页 > 表格模板 > 合同协议

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

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