基于FPGA出租车计价器课设11页

上传人:文库****9 文档编号:173996691 上传时间:2021-03-15 格式:DOC 页数:11 大小:27.50KB
返回 下载 相关 举报
基于FPGA出租车计价器课设11页_第1页
第1页 / 共11页
基于FPGA出租车计价器课设11页_第2页
第2页 / 共11页
基于FPGA出租车计价器课设11页_第3页
第3页 / 共11页
基于FPGA出租车计价器课设11页_第4页
第4页 / 共11页
基于FPGA出租车计价器课设11页_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《基于FPGA出租车计价器课设11页》由会员分享,可在线阅读,更多相关《基于FPGA出租车计价器课设11页(11页珍藏版)》请在金锄头文库上搜索。

1、基于FPGA的出租车计费器课程设计程序设计题目:出租车计费器一、设计实验条件QuartusII7.2二、设计目标1. 实现计费功能。按行驶里程计费,起步价为6.00元,并在车行驶3km后按1.2元/km计费,当计费器达到或超过20元时,每千米加收50%的车费,车停止和暂停时不计费;2. 现场模拟汽车的起动、停止、暂停和换挡等状态;3. 设计数码管动态扫描电路,将车费和路程显示出来,各有两位小数。三、设计报告的内容1. 前言伴随中国经济的腾飞,城市化的进程也随之加快。虽然人们出行的选择趋于多样化,但是出租车作为一种重要的交通工具,也为很多人作为出行的选择。大城市里出租车已经相当普及,但是在中小城

2、市出租车依然处于快速发展的阶段。 出租车的计费方式也在发生变化,由只能显示里程的方式变为现在的自主计费和打印发票及语音提示的智能化方式;根据出租车行业的发展需求,国内许多生产厂商也制造出不同类型的计价器,传统的出租车计费器经过十几年的使用,在稳定性,成本等方面都具有一定的优势。利用FPGA设计出满足出租车不同计费需求的计费器,去满足当地出租车的计费需求。这个课题在实现计费功能的同时,也解决了传统出租车计费器系统的不足。出租车的需求不断的增大,因此,出租车计费器的需求也将不断增大,计程车的服务也显得越来越重要,因此出租车计费器也就应运而生了。2. 设计主体(1)设计原理:假设出租车有启动键、停止

3、键、暂停键和档位键。启动键为脉冲触发信号,当它为一个脉冲是,表示汽车已启动,并根据车速的选择和基本车速发出相应频率的脉冲(计费脉冲)实现车费和路程的计数,同时车费显示起步价;当停止键为高电平时,表示汽车熄火,同时停止发出脉冲,此时车费和路程计数清零;当暂停键为高电平时,表示汽车暂停并停止发出脉冲,此时车费和路程计数暂停;档位键用来改变车速,不同档位对应着不同的车速,同时路程计数的速度也不同。出租车计费器可分为两大模块,即控制模块和译码显示模块,系统框图如图1所示,控制模块实现了计费和路程的技术,并且通过不同的档位控制车速。译码显示模块实现了十进制到4位十进制的转换,以及车费和路程的显示。图1

4、出租车计费器系统框图(2)步骤: 首先设计taxi计费模块,实现计费功能。起步价为6.00元,并在车行驶3km后按1.2元/km计费,当计费器达到或超过20元时,每千米加收50%的车费,车停止和暂停时不计费。taxi模块程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity taxi isport(clk:in std_logic;-计费时钟start:in std_logic;-汽车起动stop:in std_logic;-汽车停止pause:in std_logic;-汽车暂停

5、speedup:in std_logic_vector(1 downto 0);-档位(4个档位)money:out integer range 0 to 8000;-车费distance:out integer range 0 to 8000);-路程end;architecture one of taxi isbeginprocess(clk,start,stop,pause,speedup)variable money_reg,distance_reg:integer range 0 to 8000;-车费和路程的寄存器variable num:integer range 0 to 9;

6、-控制车速的计数器variable dis:integer range 0 to 100;-千米计数器variable d:std_logic;-千米标志位beginif stop=1then-汽车停止,计费和路程清零money_reg:=0;distance_reg:=0;dis:=0;num:=0;elsif start=1then-汽车起动后,起步价为6元money_reg:=600;distance_reg:=0;dis:=0;num:=0;elsif clkevent and clk=1thenif start=0and speedup=00and pause=0 and stop=

7、0then-1档 if num=9 thennum:=0;distance_reg:=distance_reg+1;dis:=dis+1;else num:=num+1;end if;elsif start=0and speedup=01and pause=0 and stop=0then-2档 if num=9 thennum:=0;distance_reg:=distance_reg+2;dis:=dis+2;else num:=num+1;end if;elsif start=0and speedup=10and pause=0 and stop=0then-3档 if num=9 th

8、ennum:=0;distance_reg:=distance_reg+5;dis:=dis+5;else num:=num+1;end if;elsif start=0and speedup=11and pause=0 and stop=0then-4档 distance_reg:=distance_reg+1;dis:=dis+1;end if;if dis=100 thend:=1;dis:=0;else d:=0;end if;if distance_reg=300 then-如果超过3km按1.2元/千米计算 if money_reg=2000 and d=1thenmoney_re

9、g:=money_reg+180;-当计费器达到20元,每千米加收50%的车费 end if;end if;end if;money=money_reg;distance=distance_reg;end process;end; 将输出的费用和路程作为输入,给decoder模块,完成数码管显示功能,并且对小数点等做出明确定义。decoder程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity decoder isport(clk20mhz:in std_logic;-系统时钟2

10、0MHZmoney_in:in integer range 0 to 8000;-车费distance_in:in integer range 0 to 8000;-路程scan:out std_logic_vector(7 downto 0);-数码管地址选择信号seg7:out std_logic_vector(6 downto 0);-7段显示控制信号(abcdefg) dp:out std_logic);-小数点end;architecture one of decoder issignal clk1khz:std_logic;-1KHZ的分频时钟,用于扫描数码管地址 signal d

11、ata:std_logic_vector(3 downto 0);signal m_one,m_ten,m_hun,m_tho:std_logic_vector(3 downto 0);-钱数的4位十进制表示signal d_one,d_ten,d_hun,d_tho:std_logic_vector(3 downto 0);-路程的4位十进制表示begin-1KHZ分频,用于扫描数码管地址-process(clk20mhz)variable count:integer range 0 to 9999;beginif clk20mhzevent and clk20mhz=1thenif cou

12、nt=9999 then clk1khz=not clk1khz;count:=0;else count:=count+1;end if;end if;end process;-将车费的十进制数转化为4位十进制数-process(clk20mhz,money_in)variable comb1:integer range 0 to 8000;variable comb1_a,comb1_b,comb1_c,comb1_d:std_logic_vector(3 downto 0); beginif clk20mhzevent and clk20mhz=1thenif comb1money_in

13、thenif comb1_a=9 and comb1_b=9 and comb1_c=9 thencomb1_a:=0000;comb1_b:=0000;comb1_c:=0000;comb1_d:=comb1_d+1;comb1:=comb1+1;elsif comb1_a=9 and comb1_b=9 thencomb1_a:=0000;comb1_b:=0000;comb1_c:=comb1_c+1;comb1:=comb1+1;elsif comb1_a=9 thencomb1_a:=0000;comb1_b:=comb1_b+1;comb1:=comb1+1;elsecomb1_a

14、:=comb1_a+1;comb1:=comb1+1;end if;elsif comb1=money_in thenm_one=comb1_a;m_ten=comb1_b;m_hun=comb1_c;m_thomoney_in thencomb1_a:=0000;comb1_b:=0000;comb1_c:=0000;comb1_d:=0000;comb1:=0;end if;end if;end process;-将路程的十进制转化为4位十进制数-process(clk20mhz,distance_in)variable comb2:integer range 0 to 8000;variable comb2_a,comb2_b,comb2_c,comb2_d:std_logic_vector(3 downto 0); beginif clk20mhzevent and clk20mhz=1thenif comb2distance_in thenif comb2_a=9 and comb2_b=9 and comb2_c=9 thencomb2

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号