出租车计价器VHDL程序与仿真.docx
- 文档编号:2287788
- 上传时间:2022-10-28
- 格式:DOCX
- 页数:8
- 大小:157.52KB
出租车计价器VHDL程序与仿真.docx
《出租车计价器VHDL程序与仿真.docx》由会员分享,可在线阅读,更多相关《出租车计价器VHDL程序与仿真.docx(8页珍藏版)》请在冰豆网上搜索。
出租车计价器VHDL程序与仿真
signalen1,en0,f:
std_logic;--使能信号
begin
feipin:
process(clk_240,start)
begin
ifclk_240'eventandclk_240='1'then
ifstart='0'thenq_15<=0;q_16<=0;f_15<='0';f_16<='0';f_1<='0';f<='0';
else
ifq_15=15thenq_15<=0;f_15<='1';--此IF语句得到频率为15Hz的信号
elseq_15<=q_15+1;f_15<='0';
endif;
ifq_16=14thenq_16<=0;f_16<='1';--此IF语句得到频率为16Hz的信号
elseq_16<=q_16+1;f_16<='0';
endif;
ifq_1=239thenq_1<=0;f_1<='1';--此IF语句得到频率为1Hz的信号
elseq_1<=q_1+1;f_1<='0';
endif;
ifen1='1'thenf<=f_15;--此IF语句得到计费脉冲f
elsifen0='1'thenf<=f_16;
elsef<='0';
endif;
endif;
endif;
endprocess;
process(f_1)
begin
iff_1'eventandf_1='1'then
ifstart='0'then
w<=0;en1<='0';en0<='0';m1<="000";m0<="0000";k1<="0000";k0<="0000";
elsifstop='1'then
ifw=59thenw<=0;--此IF语句完成等待计时
ifm0="1001"thenm0<="0000";--此IF语句完成分计数
ifm1<="101"thenm1<="000";
elsem1<=m1+1;
endif;
elsem0<=m0+1;
endif;
ifm1&m0>"0000001"thenen1<='1';--此IF语句得到en1使能信号
elseen1<='0';
endif;
elsew<=w+1;en1<='0';
endif;
elsiffin='1'then
ifk0="1001"thenk0<="0000";--此IF语句完成公里脉冲计数
ifk1="1001"thenk1<="0000";
elsek1<=k1+1;
endif;
elsek0<=k0+1;
endif;
ifk1&k0>"00000010"thenen0<='1';--此IF语句得到en0使能信号
elseen0<='0';
endif;
elseen1<='0';en0<='0';
endif;
cha3<=c3;cha2<=c2;cha1<=c1;cha0<=c0;--费用数据输出
km1<=k1;km0<=k0;min1<='0'&m1;min0<=m0;--公里数据、分钟数据输出
endif;
endprocess;
process(f,start)
begin
ifstart='0'thenc3<="0000";c2<="0001";c1<="0000";c0<="0000";
elsiff'eventandf='1'then
ifc0="1001"thenc0<="0000";--此IF语句完成对费用的计数
ifc1="1001"thenc1<="0000";
ifc2="1001"thenc2<="0000";
ifc3<="1001"thenc3<="0000";
elsec3<=c3+1;
endif;
elsec2<=c2+1;
endif;
elsec1<=c1+1;
endif;
elsec0<=c0+1;
endif;
endif;
endprocess;
endbehav;
程序仿真图
注:
1.仿真图中秒跟分的关系为3进制,即w为2时就归0;
2.出租车总行驶5公里,等待累计时间为4分钟,总费用为16.2元。
出租计价器程序仿真全图
出租计价器程序仿真图-1
注:
行驶公里数为4时,f得到16个计价脉冲数,计价器加16。
既等效于加1.6元。
出租计价器程序仿真图-2
注:
等待累计时间为3分钟时,f得到15个计价脉冲。
计价器的数值增加15。
即等效于加1.5元。
出租计价器程序仿真图-3
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 出租车 计价器 VHDL 程序 仿真
![提示](https://static.bdocx.com/images/bang_tan.gif)