出租车计费器的设计 1. 设计任务 设计并制作一台出租车计费器。 2. 设计要求 ① 用EDA实训仪的I/O设备和PL

3.1.7 出租车计费器的设计
1. 设计任务
设计并制作一台出租车计费器。
2. 设计要求
① 用EDA实训仪的I/O设备和PLD芯片实现出租车计费器的设计。
② 出租车起步开始计程和计费,计程系统按实际公里数计程,计费系统首先显示起步价(如7.0),车行驶2km以内,只收起步价7元。
③ 出租车行驶超过2km后,按每公里1.6元在7.0元的基础上增加。
④ 出租车行驶超过10km后(或超过20元路费),每公里加收50%的车费,即车费变为每公里2.4元。
⑤ 出租车达到目的地后,(用一个按钮)计程和计费数据清零,为下一次计费开始。
EAD 实训。。。用Verilog HDLFile 写

第1个回答  2011-04-24
process (clk ,start ,stop ,pause ,js)
variable a ,b : std logic ;
variable aa :integer range 0 to 100 ;
variable chf ,lc :integer range 0 to 8000 ;
variable num:integer range 0 to 9 ;
begin
if clk′event and clk =‘1’ then
if stop =‘0’ then
chf : = 0 ;
num: = 0 ;
b : =‘1’;
aa : = 0 ;
lc : = 0 ;
elsif start =′0′ then
b : =′0′;
chf : = 700 ;
lc : = 0 ;
elsif start =′1′and js =′1′and pause =′1′ then
if b =′0′)then
num: = num + 1 ;
end if ;
if num = 9)then
lc : = lc + 5 ;
num: = 0 ;
aa : = aa + 5 ;
end if ;
elsif start =′1′and js =′0′and pause =′1′then
lc : = lc + 1 ;
aa : = aa + 1 ;
end if ;
if aa > = 100 then
a : =′1′;
aa : = 0 ;
else
a : =′0′;
end if ;
if lc < 300 then
null ;
elsif chf < 2000 and a =′1′ then
chf : = chf + 220 ;
elsif chf > = 2000 and a =′1′ then
chf : = chf + 330 ;
end if ;
end if ;
chefei < = chf ;
luc < = lc ;
end process ;
把if后的括号都去了,不需要的,你再试试,如果不行再联系。
相似回答