• 方案介绍
  • 附件下载
  • 相关推荐
申请入驻 产业图谱

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

06/03 08:17
540
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

2-23121F944023E.doc

共1个文件

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

软件:Quartus

语言:Verilog

代码功能:

自助点餐机设计,商品分为7、9、14元三种套餐,并且只接受5、10元两种面值的纸币。

可以一次点多份,用数码管显示购买数量、所需金额、找零金额,当金额不足时通过蜂鸣器提示。

FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com

本代码已在远程云端平台验证,远程云端平台如下,其他远程云端平台可以修改管脚适配:远程平台照片.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

点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=342

  • 2-23121F944023E.doc
    下载

相关推荐