基于vhdl编程fpga的地铁自动售票机设计说明书.docx
- 文档编号:2992934
- 上传时间:2022-11-16
- 格式:DOCX
- 页数:36
- 大小:46.92KB
基于vhdl编程fpga的地铁自动售票机设计说明书.docx
《基于vhdl编程fpga的地铁自动售票机设计说明书.docx》由会员分享,可在线阅读,更多相关《基于vhdl编程fpga的地铁自动售票机设计说明书.docx(36页珍藏版)》请在冰豆网上搜索。
基于vhdl编程fpga的地铁自动售票机设计说明书
地铁自动售票机
一、设计要求
1、功能描述
用于模仿地铁售票自动售票,完成地铁售票的核心控制功能。
2、功能要求
售票机有两个进币孔,一个是输入硬币,识别的范围是一元硬币;一个是纸币,识别的范围是一元、两元、五元、十元、二十元。
乘客可以连续多次投入钱币。
乘客一次只能选择一个出站口,购买车票时,乘客先选出站口,有六个出站口可供选择,再选择所需的票数,然后投币,投入的钱币达到或者超过所需金额时,售票机自动出票,并找零。
本次交易结束后,等待下一次交易。
在选择出站口、所需票数以及在投币期间,乘客可以按取消键取消操作,钱币自动退出。
二、实验分析
1、 买票时,乘客按下开始键,售票机进入站台选择程序,乘客选择出站口后,可以按取消键重新选择,否则售票机自动进入票数选择程序,同样这时可以按下取消键重新开始选择出站口以及票数。
2、 当选择好出站口以及所需票数时,乘客可以投硬币或者用纸币,当所投的钱币总额大于或者等于票价时,售票机自动出票以及找零。
期间,可以按下取消键重新开始选择,并退出所有的钱币。
3、 乘客若还没选择出站口或者票数,就投币或者使用纸币,售票机会自动退出所有的钱币。
4、 有六个站台可供乘客选择,每个乘客最多可以买3张票,六个站台编号为1到6,票价从2元依次递增到7。
三、系统流程图
四、程序源代码
LIBRARYIEEE;
USEIEEE.std_logic_1164.ALL;
USEIEEE.std_logic_arith.ALL;
USEIEEE.std_logic_unsigned.ALL;
ENTITYmetrosellIS
PORT<
clk:
instd_logic; --settheclocksignal
startselect:
instd_logic; --starttoselecttheplatform
sure:
instd_logic; --thisbuttonistosaveyourforwardstep
coin1y:
instd_logic; --1yuancoin
pmoney1y:
instd_logic; --1yuanpapermoney
pmoney2y:
instd_logic; --2yuanpapermoney
pmoney5y:
instd_logic; --5yuanpapermoney
pmoney10y:
instd_logic; --10yuanpapermoney
pmoney20y:
instd_logic; --20yuanpapermoney
cancel:
instd_logic; --canceltheforwardstep
number:
instd_logic_vector<3downto0>; --choosethenumberofthetickets
platform:
instd_logic_vector<3downto0>; --choosetheplatformyouwanttoreach
moneystorage:
outstd_logic; --tostorethemoney
acceptmo:
outstd_logic; --acceptthemoney
stamp:
outstd_logic; --stampoutgate
charge:
outstd_logic_vector<3downto0>; --themountofcharge,upto15yuan
chargegate:
outstd_logic --chargeoutgate
>;
ENDmetrosell;
ARCHITECTUREsellOFmetrosellIS
typestate_typeis
--definesixtypes
signalstate:
state_type; --defineasharedstate
BEGIN
main:
process
variableunivalence:
integerrange0to7; --theunivalenceoftheticket
variabletotal_money:
integerrange0to21;--thepriceoftheticket
variableselectp_alr:
std_logic; --theflagofselectplatformtype
variableselectnum_alr:
std_logic; --theflagofselectnumbertype
variablestamp_alr:
std_logic; --theflagofthestampgate
variablecharge_alr:
std_logic; --theflagofthechargegate
variablemoney_reg:
integerrange0to21; --themountofmoneyputin
variablecoin1y_f:
std_logic; --theflagofoneyuancoin
variablepmoney1y_f:
std_logic; --theflagofoneyuanpapermoney
variablepmoney2y_f:
std_logic; --theflagoftwoyuanpapermoney
variablepmoney10y_f:
std_logic; --theflagoftenyuanpapermoney
variablepmoney20y_f:
std_logic; --theflagoftwelveyuanpapermoney
variablepmoney5y_f:
std_logic; --theflagoffiveyuanpapermoney
variablecharge_reg:
integerrange0to15; --theregisterofcharge
begin
if
casestateis
wheninitial_type=> --initializesomevariables
univalence:
=0;
selectp_alr:
='0';
selectnum_alr:
='0';
stamp_alr:
='0';
charge_a
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 vhdl 编程 fpga 地铁 自动 售票 设计 说明书
![提示](https://static.bdocx.com/images/bang_tan.gif)