EDA出租车自动计费器.docx

上传人:b****1 文档编号:10515226 上传时间:2023-05-26 格式:DOCX 页数:16 大小:354.77KB
下载 相关 举报
EDA出租车自动计费器.docx_第1页
第1页 / 共16页
EDA出租车自动计费器.docx_第2页
第2页 / 共16页
EDA出租车自动计费器.docx_第3页
第3页 / 共16页
EDA出租车自动计费器.docx_第4页
第4页 / 共16页
EDA出租车自动计费器.docx_第5页
第5页 / 共16页
EDA出租车自动计费器.docx_第6页
第6页 / 共16页
EDA出租车自动计费器.docx_第7页
第7页 / 共16页
EDA出租车自动计费器.docx_第8页
第8页 / 共16页
EDA出租车自动计费器.docx_第9页
第9页 / 共16页
EDA出租车自动计费器.docx_第10页
第10页 / 共16页
EDA出租车自动计费器.docx_第11页
第11页 / 共16页
EDA出租车自动计费器.docx_第12页
第12页 / 共16页
EDA出租车自动计费器.docx_第13页
第13页 / 共16页
EDA出租车自动计费器.docx_第14页
第14页 / 共16页
EDA出租车自动计费器.docx_第15页
第15页 / 共16页
EDA出租车自动计费器.docx_第16页
第16页 / 共16页
亲,该文档总共16页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

EDA出租车自动计费器.docx

《EDA出租车自动计费器.docx》由会员分享,可在线阅读,更多相关《EDA出租车自动计费器.docx(16页珍藏版)》请在冰点文库上搜索。

EDA出租车自动计费器.docx

EDA出租车自动计费器

 

EDA课程设计报告

《出租车自动计费器》

 

姓名:

学号:

班级:

指导老师:

 

二,系统的设计要求

1、设计一个出租车自动计费器,具有行车里程计费、等候时间计费、及起价三部分,用四位数码管显示总金额,最大值为99.99元;

2、行车里程单价1元/公里,等候时间单价0.5元/10分钟,起价3元(3公里起价)均能通过人工输入。

3、行车里程的计费电路将汽车行驶的里程数转换成与之成正比的脉冲数,然后由计数译码电路转换成收费金额,实验中以一个脉冲模拟汽车前进十米,则每100个脉冲表示1公里,然后用BCD码比例乘法器将里程脉冲乘以每公里单价的比例系数,比例系数可由开关预置。

例如单价是1.0元/公里,则脉冲当量为0.01元/脉冲。

4、用LED显示行驶公里数,两个数码管显示收费金额。

教学提示:

1、等候时间计费需将等候时间转换成脉冲个数,用每个脉冲表示的金额与脉冲数相乘即得计费数,例如100个脉冲表示10分钟,而10分钟收费0。

5元,则脉冲当量为0。

05元/脉冲,如果将脉冲当量设置成与行车里程计费相同(0。

01元/脉冲),则10分钟内的脉冲数应为500个。

2、用LED显示等候时间,两个数码管表示等候时间收费金额。

3、用加法器将几项收费相加,P=P1+P2+P3,

P1为起价,P2为行车里程计费,P3为等候时间计费,用两个数码管表示结果。

3、设计方案

根据出租车计费系统的要求可知,整个出租车计费系统可由速度模块、计程模块、计费模块和显示模块等部分电路构成。

在FPGA/CPLD中可设计这些基本模块的电路功能,然后将这些模块进行有机组合,即可形成出租车计费系统。

显示模块可采用共阴极七段LED数码管实现,出租车内部电路如图:

其输出接LED显示即可显示路程和费用。

4、模块设计

(1)档位选择程序

通过三个按键输入,即a,b,c,由此决定出租车的档位SP。

libraryieee;

useieee.std_logic_1164.all;

entitydwxzis

port(a,b,c:

instd_logic;

reset:

instd_logic;

sp:

outstd_logic_vector(2downto0)

);

enddwxz;

architecturethreeofdwxzis

begin

process(reset,a,b,c)

begin

ifreset='1'then

sp<="000";

elsifa='0'andb='0'andc='1'thensp<="001";

elsifa='0'andb='1'andc='0'thensp<="010";

elsifa='0'andb='1'andc='1'thensp<="011";

elsifa='1'andb='0'andc='0'thensp<="100";

elsifa='1'andb='0'andc='1'thensp<="101";

elsifa='1'andb='1'andc='0'thensp<="110";

elsifa='0'andb='0'andc='0'thensp<="000";

elsesp<="000";

endif;

endprocess;

endthree;

其原理图模式为:

(2)速度模块程序

速度模块是通过对速度信号SP的判断以决定出租车每行驶100M需要的时间值,然后判断车行驶的时间是否等于所设定的时间值,若二者相等,则产生一个100M的CLKOUT信号。

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityspeedis

port(clk:

instd_logic;

reset:

instd_logic;

start:

instd_logic;

stop:

instd_logic;

sp:

instd_logic_vector(2downto0);

clkout:

outstd_logic);

endspeed;

architectureoneofspeedis

typestatesis(s0,s1);

signalstate:

states;

signalcnt:

integerrange0to30;

signalstall_value:

integerrange0to30;

begin

u1:

process(sp)

begin

casespis

when"000"=>stall_value<=0;

when"001"=>stall_value<=30;

when"010"=>stall_value<=26;

when"011"=>stall_value<=22;

when"100"=>stall_value<=18;

when"101"=>stall_value<=14;

when"110"=>stall_value<=10;

whenothers=>null;

endcase;

endprocessu1;

u2:

process(clk,reset,start,stop,stall_value)

begin

ifreset='1'then

state<=s0;

elsifclk'eventandclk='1'then

casestateis

whens0=>

cnt<=0;

clkout<='0';

ifstart='1'then

state<=s1;

else

state<=s0;

endif;

whens1=>

clkout<='0';

ifstop='1'then

state<=s1;

elsifcnt=stall_valuethen

cnt<=0;

clkout<='1';

state<=s1;

else

cnt<=cnt+1;

state<=s1;

endif;

endcase;

endif;

endprocessu2;

endone;

其原理图:

此模块可满足模拟停车,暂停计费,清零的效果。

并且能够时刻调整档位SP来调整速度,最后输出的是CLKOUT,即一个CLKOUT信号就代表车子行驶了100m,从而计程显示输出,同时作为计费的输入。

 

(3)计程模块程序

输入是CLKOUT,通过对它计数并且输出。

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitykilometersis

port(reset:

instd_logic;

clkout:

instd_logic;

km_cnt0:

outstd_logic_vector(3downto0);

km_cnt1:

outstd_logic_vector(3downto0);

km_cnt2:

outstd_logic_vector(3downto0);

km_cnt3:

outstd_logic_vector(3downto0);

km_cnt4:

outstd_logic_vector(3downto0)

);

endkilometers;

architecturetwoofkilometersis

signalcnt0:

std_logic_vector(3downto0);

signalcnt1:

std_logic_vector(3downto0);

signalcnt2:

std_logic_vector(3downto0);

signalcnt3:

std_logic_vector(3downto0);

signalcnt4:

std_logic_vector(3downto0);

begin

process(reset,clkout)

begin

ifreset='1'then

cnt0<="0000";

cnt1<="0000";

cnt2<="0000";

cnt3<="0000";

cnt4<="0000";

elsifclkout'eventandclkout='1'then

ifcnt3="1001"andcnt2="1001"andcnt1="1001"andcnt0="1001"andcnt4="1001"then

cnt0<="0000";

cnt1<="0000";

cnt2<="0000";

cnt3<="0000";

cnt4<="0000";

elsifcnt3/="1001"andcnt2="1001"andcnt1="1001"andcnt0="1001"andcnt4="1001"then

cnt0<="0000";

cnt1<="0000";

cnt2<="0000";

cnt3<=cnt3+"0001";

cnt4<="0000";

elsifcnt2/="1001"andcnt1="1001"andcnt0="1001"andcnt4="1001"then

cnt0<="0000";

cnt1<="0000";

cnt2<=cnt2+"0001";

cnt3<=cnt3;

cnt4<="0000";

elsifcnt1/="1001"andcnt0="1001"andcnt4="1001"then

cnt0<="0000";

cnt1<=cnt1+"0001";

cnt2<=cnt2;

cnt3<=cnt3;

cnt4<="0000";

elsifcnt0/="1001"andcnt4="1001"then

cnt0<=cnt0+"0001";

cnt1<=cnt1;

cnt2<=cnt2;

cnt3<=cnt3;

cnt4<="0000";

elsifcnt4/="1001"then

cnt0<=cnt0;

cnt1<=cnt1;

cnt2<=cnt2;

cnt3<=cnt3;

cnt4<=cnt4+"0001";

endif;

endif;

km_cnt0<=cnt0;

km_cnt1<=cnt1;

km_cnt2<=cnt2;

km_cnt3<=cnt3;

km_cnt4<=cnt4;

endprocess;

endtwo;

(4)计费模块程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitymoneyis

port(clk:

instd_logic;

clkout:

instd_logic;

reset:

instd_logic;

km_cnt1:

instd_logic_vector(3downto0);

km_cnt2:

instd_logic_vector(3downto0);

km_cnt3:

instd_logic_vector(3downto0);

money1:

outstd_logic_vector(3downto0);

money2:

outstd_logic_vector(3downto0);

money3:

outstd_logic_vector(3downto0));

endmoney;

architecturefourofmoneyis

signalmoney_cn0:

std_logic_vector(3downto0);

signalmoney_cn1:

std_logic_vector(3downto0);

signalmoney_cn2:

std_logic_vector(3downto0);

signalmoney_cn3:

std_logic_vector(3downto0);

signalprice0:

std_logic_vector(3downto0);

signalprice1:

std_logic_vector(3downto0);

signalenable:

std_logic;

begin

u1:

process(km_cnt1,money_cn2)

begin

ifmoney_cn2>="0011"then

price1<="0010";

price0<="1000";

elsifkm_cnt1>="0001"then

enable<='1';

else

enable<='0';

endif;

endprocessu1;

u2:

process(reset,clkout,clk,price1,price0,enable)

variableclkout_cnt:

integerrange0to10;

begin

ifreset='1'then

money_cn0<=price0;

money_cn1<=price1;

money_cn2<="0000";

money_cn3<="0000";

elsif(clk'eventandclk='1'andclkout='1'andenable='1')or(clk'eventandclk='1'andmoney_cn2>="0001")then

ifclkout_cnt=9then

clkout_cnt:

=0;

ifmoney_cn3>="1001"then

money_cn3<="0000";

else

money_cn3<=money_cn3;

ifmoney_cn2>="1001"then

money_cn2<="0000";

money_cn3<=money_cn3+"0001";

else

money_cn2<=money_cn2;

ifmoney_cn1>="1001"then

money_cn1<="0000";

money_cn2<=money_cn2+"0001";

else

money_cn1<=money_cn1;

ifmoney_cn0>="1001"then

money_cn0<="0000";

money_cn0<=money_cn0+"0001";

else

money_cn0<=money_cn0+price0;

endif;endif;endif;

endif;

endif;

clkout_cnt:

=clkout_cnt+1;

endif;

money3<=money_cn3;

money2<=money_cn2;

money1<=money_cn1;

endprocessu2;endfour;

(5)出租车计费器

最后通过原理图输入组合以上模块就得到了这个计费器的原理图。

 

(6)计费器控制仿真及分析

根据输入要求有6个按键,输出要8个数码管显示,所以选择结构图NO.0:

目标芯片的PIO19至PIO44共8组4位2进制码输出,经外部的7段译码器可显示于实验系统上的8个数码管。

键1和键2可分别输出2个四位2进制码。

一方面这四位码输入目标芯片的PIO11~PIO8和PIO15~PIO12,另一方面,可以观察发光管D1至D8来了解输入的数值。

例如,当键1控制输入PIO11~PIO8的数为^HA时,则发光管D4和D2亮,D3和D1灭。

电路的键8至键3分别控制一个高低电平信号发生器向目标芯片的PIO7至PIO2输入高电平或低电平,扬声器接在“SPEAKER”上,具体接在哪一引脚要看目标芯片的类型,如目标芯片为EP1K30TC144-3,则扬声器接在“99”引脚上。

实验电路结构图NO.0

 

然后就按照引脚号锁定引脚后,结果如图:

 

最后波形仿真结果:

五、总结

通过这次EDA课程设计,使我更加的了解了EDA,VHDL语言和外部设备的接线。

也让我更加了解了EDA设计的流程和原理。

通过本次设计,让我很好的锻炼了理论联系实际,与具体项目、课题相结合开发、设计产品的能力。

既让我们懂得了怎样把理论应用于实际,又让我们懂得了在实践中遇到的问题怎样用理论去解决。

在本次设计中,我们还需要一些上课时没有牢固的知识,于是图书馆和INTERNET成了我们很好的助手。

在查阅资料的过程中,我们要判断优劣、取舍相关知识,不知不觉中我们查阅资料的能力也得到了很好的锻炼。

我们学习的知识是有限的,在以后的工作中我们肯定会遇到许多未知的领域,这方面的能力便会使我们受益非浅。

在设计过程中,总是遇到这样或那样的问题。

有时发现一个问题的时候,需要做大量的工作,花大量的时间才能解决。

自然而然,我的耐心便在其中建立起来了。

为以后的工作积累了经验,增强了信心。

我认为,不仅仅是此次考查设计,在整个这学期的实验中,不仅培养了独立思考、动手操作的能力,在各种其它能力上也都有了提高。

更重要的是,在实验课上,我们学会了很多学习的方法。

而这是日后最实用的,真的是受益匪浅。

 

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

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2