首页 全自动洗衣机的设计 Verilog程序

全自动洗衣机的设计 Verilog程序

举报
开通vip

全自动洗衣机的设计 Verilog程序数字逻辑课程设计报告 姓  名:                  学  号:                  选课号:  103            班  号:  A201            设计题目 全自动洗衣机的设计 设计要求 设计全自动洗衣机控制器,为不同的洗衣阶段设置不同的时间。(洗衣阶段和时间自己定义) 设计过程 设计方案: 全自动洗衣机有9个工作状态:空闲(idle),第一次加水(water1),洗涤(wash),第一次排水(drain1),第二次加水(water2...

全自动洗衣机的设计 Verilog程序
数字逻辑课程设计 报告 软件系统测试报告下载sgs报告如何下载关于路面塌陷情况报告535n,sgs报告怎么下载竣工报告下载 姓  名:                  学  号:                  选课号:  103            班  号:  A201            设计题目 全自动洗衣机的设计 设计要求 设计全自动洗衣机控制器,为不同的洗衣阶段设置不同的时间。(洗衣阶段和时间自己定义) 设计过程 设计 方案 气瓶 现场处置方案 .pdf气瓶 现场处置方案 .doc见习基地管理方案.doc关于群访事件的化解方案建筑工地扬尘治理专项方案下载 : 全自动洗衣机有9个工作状态:空闲(idle),第一次加水(water1),洗涤(wash),第一次排水(drain1),第二次加水(water2),漂洗(rinse),第二次排水(drein2),甩干(dry),响起音乐(music)。 状态转移条件有以下2个:开始(start),复位(reset)。 状态转移图: 注:方框内上方为状态机的状态,下方为状态机的输出。 当按下reset键时,洗衣机复位到初始状态,m=0,w=0,d=0,mu=0。当按下start按钮时,则进入water1状态,w=1,加水,历时5s。然后转移到下一个状态------洗涤,停止加水w=0,电机运转m=1,历时10s。再转移到下一个状态排水,电机停止运转m=0,开始排水d=1,历时5s……直到甩干结束后,整个洗衣过程完成。然后洗衣机放出音乐,历时7s,提示用户洗衣完成。洗衣机回到初始状态。整个过程经历45s。 源程序: module wash_machine(count,clk,reset,start,w,m,d,mu,state); input clk,reset,start; output w,m,d,mu,state; output [3:0]count; reg[3:0] count; parameter idle=0,water1=1,wash=2,drain1=3,water2=4,rinse=5,drain2=6,dry=7,music=8; reg w,m,d,mu; reg [3:0] state; always @(posedge clk) begin if(reset) begin w<=0;m<=0;d<=0;mu<=0; state<=idle; end case(state) idle: if(start) begin w<=1;m<=0;d<=0;mu<=0; state<=water1; end water1: if(count==4) //the time of water is 5s begin count<=1'd0; w<=0;m<=1;d<=0;mu<=0; state<=wash; end else begin count<=count+1; end wash: if(count==9) //the time of wash is 10s begin count<=1'd0; w<=0;m<=0;d<=1;mu<=0; state<=drain1; end else begin count<=count+1; end drain1: if(count==4) //the time of drain is 5s begin count<=1'd0; w<=1;m<=0;d<=0;;mu<=0; state<=water2; end else begin count<=count+1; end water2: if(count==4) //the time of water is 5s begin count<=1'd0; w<=0;m<=1;d<=0;mu<=0; state<=rinse; end else begin count<=count+1; end rinse: if(count==5) //the time of rinse is 6s begin count<=1'd0; w<=0;m<=0;d<=1;mu<=0; state<=drain2; end else begin count<=count+1; end drain2: if(count==4) //the time of drain is 5s begin count<=0; w<=0;m<=1;d<=1;mu<=0; state<=dry; end else begin count<=count+1; end dry: if(count==2) //the time of dry is 3s begin count<=1'd0; w<=0;m<=0;d<=0;mu<=1; state<=music; end else begin count<=count+1; end music: if(count==6) //the time of music is 7s begin count<=1'd0; state<=idle; w<=0;m<=0;d<=0;mu<=0; end else begin count<=count+1; end endcase end endmodule 仿真结果: 设计结论 设计结果 分析 定性数据统计分析pdf销售业绩分析模板建筑结构震害分析销售进度分析表京东商城竞争战略分析 : 按下reset键,洗衣机复位;按下start键,开始洗衣,直到洗衣完成。 设计中遇到的问题: 1、 每个状态无法持续,来了一个时钟就进入下一个状态了,没有判断我写的条件: 例如:原来在water1的条件下,我写的是: water1: if(count<(timewater-1)) begin count<=count+1; end else begin count<=1'd0; w<=0;m<=1;d<=0;mu<=0; state<=wash; end 结果就是下图所示: (错误的仿真结果) 后来改成了: water1: if(count==4) begin count<=1'd0; w<=0;m<=1;d<=0;mu<=0; state<=wash; end else begin count<=count+1; end 原因是:if不是循环,只要条件满足就执行下去,不会再判断条件仍旧满足而再执行if里面的语句。 设计心得: 1、学习并基本掌握了verilog HDL的写法,并会用verilog HDL语言设计有限状态机。会写计数器,并且在历经设计好的一段时间后跳到下一状态。 2、实现经过一段时间后状态的跳转:在每个时钟上升沿到来时(always @clk),先判断时间条件是否成立,成立的话就进入下一个状态,如果时间没有到的话,时间就加1,在下一个始终上升沿到来时再先判断,没到的话再加1,如此重复。 3、这是写的第一个verilog程序,还是很有成就感!     附:放大的仿真图:
本文档为【全自动洗衣机的设计 Verilog程序】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_852287
暂无简介~
格式:doc
大小:26KB
软件:Word
页数:9
分类:互联网
上传时间:2019-02-11
浏览量:23