下载此文档

EDA售饮料机.doc


文档分类:通信/电子 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
设计目标:实现收取5元和十元两种货币,共销售矿泉水和可乐两种饮料,售价分别为2元和4元。一共有3种状态,购买完饮料,应按下确认按钮,实现复位功能。状态图:投入5元状态s1初始s0状态s2投入10元状态s1、s2时实现输出饮料和找零。此售饮料系统一次只能购买一次,功能简单,较易实现。因为投入只有5元和10元两种情况,一次购买只有一瓶,所以找零只有4种情况,分别用ret="00","01","10","11"表示其逻辑。inp_1,inp_2分别表示投入5元和10元;outp="01","10"表示输出矿泉水和可乐两种饮料。实验程序:libraryieee;;entitysellingis port(clk,reset,inp_1,inp_2,price_1,price_2:instd_logic; outp,ret:outstd_logic_vector(1downto0));endentity;architecturebehavofsellingistypefsm_stis(s0,s1,s2);signalc_st,next_state:fsm_st;beginreg:process(clk,reset)beginifreset='0'thenc_st<=s0;elsifclk='1'andclk'eventthenc_st<=next_state;endif;:process(c_st,reset,inp_1,inp_2,price_1,price_2)begincasec_stiswhens0=> ifinp_1='1'thennext_state<=s1; elsenext_state<=s1;endif; ifinp_2='1'thennext_state<=s2; elsenext_state<=s0;endif; whens1=> ifprice_1='1'thenoutp<="01"; ret<="00"; next_state<=s0; elsenext_state<=s1;endif; ifprice_2='1'thenoutp<="10"; ret<="01"; next_state<=s0; elsenext_state<=s1;endif;whens2=> ifprice_1='1'thenoutp<="01"; ret<="10"; next_state<=s0; elsenext_state<=s2;endif; ifprice_2='1'thenoutp<="10"; ret<="11"; next_state<=s0; elsenext_state<=s2;endif;whenothers=>next_state<=s0;endcase;;endbehav;原理图: 撤磊属易挠厢礁墟该

EDA售饮料机 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人drp539606
  • 文件大小40 KB
  • 时间2019-03-19