自助点餐机Verilog代码远程云端平台Quartus

名称:自助点餐机Verilog代码远程云端平台Quartus

软件:Quartus

语言:Verilog

代码功能:

自助点餐机设计,

商品分为7、9、14元三种套餐,

并且只接受5、10元两种面值的纸币:

可以一次点多份:

用数码管显示购买数量、所需金额、找零金额,当金额不足时通过蜂鸣器提示

本代码已在远程云端平台验证,远程云端平台如下,其他远程云端平台可以修改管脚适配:

远程平台照片.png

1. 工程文件

2. 程序文件

3. 程序运行

4. 管脚分配

5. RTL图

6. 仿真图

仿真文件(VWF文件)

仿真图

下图仿真为选中单价9元商品,数量选为3,共需要27元,投币5+10+10+10=35元,找零8元。

部分代码展示:

//Vending_machine
//基于FPGA的自助点餐机的设计,
//商品分为7、9、14元三种套餐,
//并且只接受5、10元两种面值的纸币:
//可以一次点多份:
//用数码管显示购买数量、所需金额、找零金额,当金额不足时通过蜂鸣器提示
module auto_sell(
input clk_1K,//1K
input rst,//低电平有效
//按键 低电平有效
input Selection_goods,//选商品,商品分为7、9、14元三种套餐
input Selection_num,//选商品数量
//按键 低电平有效
input throw_into_10_down,//投10元
input throw_into_05_down,//投5元
//按键 低电平有效
input confirm_button,//确认购买,低电平有效
output  BEEP,//蜂鸣器
output  outgo_done,//出货指示灯
output  [7:0] duanxuan1,//数码房段选显示
output  [3:0] weixuan1, //数码房位选显示
output  [7:0] duanxuan2,//数码房段选显示
output  [3:0] weixuan2 //数码房位选显示
);
//所有按键取下降沿/
wire Selection_goods_out;
wire Selection_num_out;
wire throw_into_10_down_out;
wire throw_into_05_down_out;
wire confirm_button_out;
//下降沿检测模块
ax_debounce  select_goods 
(
    .  clk(clk_1K), 
    .  button_in(Selection_goods),
    .  button_negedge(Selection_goods_out)
);
//下降沿检测模块
ax_debounce  select_num 
(
    .  clk(clk_1K), 
    .  button_in(Selection_num),
    .  button_negedge(Selection_num_out)
);
//下降沿检测模块
ax_debounce  throw_into_10 
(
    .  clk(clk_1K), 
    .  button_in(throw_into_10_down),
    .  button_negedge(throw_into_10_down_out)
);
//下降沿检测模块
ax_debounce  throw_into_05 
(
    .  clk(clk_1K), 
    .  button_in(throw_into_05_down),
    .  button_negedge(throw_into_05_down_out)
);
//下降沿检测模块
ax_debounce  confirm_btt 
(
    .  clk(clk_1K), 
    .  button_in(confirm_button),
    .  button_negedge(confirm_button_out)
);
wire [7:0] total_throw_inmoney;//投入总钱币
wire [7:0] total_need_money;//选中商品价钱
wire [7:0] total_refund_money;//找零金额
wire [7:0] total_num_out;//数量
//售货状态控制模块
state_control state_control_u(
. clk_1K(clk_1K),
. rst(rst),
. Selection_goods_out(Selection_goods_out),
. Selection_num_out(Selection_num_out),
. throw_into_10_down_out(throw_into_10_down_out),
. throw_into_05_down_out(throw_into_05_down_out),
. confirm_button_out(confirm_button_out),
. BEEP(BEEP),
. outgo_done(outgo_done),//出货指示灯
. total_num_out(total_num_out),//数量
. total_throw_inmoney_out(total_throw_inmoney),//投入总钱币
. total_need_money_out(total_need_money),//选中商品价钱
. total_refund_money_out(total_refund_money)//找零金额
);
///
//数码管显示模块
display display_U(
. clk_1K(clk_1K),//50M
. total_num_out(total_num_out),//数量
. total_throw_inmoney(total_throw_inmoney),//投入总钱币
. total_need_money(total_need_money),//选中商品价钱
. total_refund_money(total_refund_money),//找零金额
. duanxuan1(duanxuan1),//数码房段选显示
. weixuan1(weixuan1), //数码房位选显示
. duanxuan2(duanxuan2),//数码房段选显示
. weixuan2(weixuan2) //数码房位选显示
);
endmodule
源代码

 扫描文章末尾的公众号二维码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值