数字电路与逻辑设计实验报告-洗衣机控制器设计.docx_第1页
数字电路与逻辑设计实验报告-洗衣机控制器设计.docx_第2页
数字电路与逻辑设计实验报告-洗衣机控制器设计.docx_第3页
数字电路与逻辑设计实验报告-洗衣机控制器设计.docx_第4页
数字电路与逻辑设计实验报告-洗衣机控制器设计.docx_第5页
已阅读5页,还剩37页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数字电路与逻辑设计实验报告 洗衣机控制器设计 学号: 班级: 一、 洗衣机控制器要求基本要求设计制作一个全自动洗衣机的控制器:_ 洗衣机的工作步骤为洗涤、漂洗和脱水三个过程,工作时间分别为:洗涤30秒(进水5秒,洗衣15秒,排水5秒,甩干5秒),漂洗25 秒(进水5秒,漂洗10秒,排水5秒,甩干5秒),脱水15 秒(排水5秒,甩干10秒);_ 用一个按键实现洗衣程序的手动选择:A、单洗涤;B、单漂洗;C、单脱水;D、漂洗和脱水;E、洗涤、漂洗和脱水全过程;_ 用显示器件显示洗衣机的工作状态(洗衣、漂洗和脱水),并倒计时显示每个状态的工作时间,全部过程结束后,应有提示音提示使用者,并保持在停止状态,直至再次开始;-用点阵动画显示洗衣机工作过程中的进水、波轮或滚轮转动、排水和甩干等的工作情况,四种工作情况的动画显示要有区别且尽可能的形象。_ 用一个按键实现暂停洗衣和继续洗衣的控制,暂停后继续洗衣应回到暂停之前保留的状态;_ 选做:三个过程的时间有多个选项供使用者选择。_ 选做:可以预约洗衣时间。_ 选做:自拟其它功能。二.系统设计(一)基本思想电路分为7个模块,分别是提供各种频率的分频模块,显示洗衣动画的点阵模块,显示倒计时的数码管模块,按键模块,模式选择模块,报警模块和控制模块。1 模式选择模块五种洗衣模式可供用户选择,模式选择模块将用户的选择信息传递到控制模块。2.点阵显示模块 点阵显示是将形象的洗衣动画模拟出来,被人们的视觉器官所接受。3.译码和数码显示模块 译码和数码显示电路是将计时状态直观清晰地反映出来,被人们的视觉器官所接受。显示器件选用LED 七段数码管。在译码显示电路输出的驱动下,显示出清晰、直观的数字符号。4.按键模块将用户的选择信息传送到模式选择模块5.报警模块 当系统运行结束时,蜂鸣器会报警提醒用户。6.分频器模块 为系统提供合适的频率的电信号7.控制模块 控制模块是整个系统的中心部分,是状态机设计部分。在该模块实现了洗衣机各种状态的运行和转换,还控制着模拟电机的显示模块。(二)总体框图(三)状态转移图State=111State=110State=001State=100State=000State=010(四)系统框图(五)控制器流程图NoNoNoNoYesYesYesYes输入状态改变状态modeMode不为000按键模块信息传递是否开始计时时间显示时间为零洗衣结束报警是否暂停暂停动画模拟洗衣衣Led显示模式选择(六)原理图三分块设计及仿真分析 1分频模块该模块一共有13个进程,利用分频的思想,将50MHZ经过分频得到不同的频率,分别用于控制模块,点阵显示模块,数码管显示模块,防抖模块模块和报警模块等。程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpinqi isport (clk: in std_logic;-20ns clkkeyout:out std_logic;-10ms clksegout: out std_logic;-1s moni 20ms clkconout: out std_logic;-5ms clkfs:out std_logic; cpout: out std_logic;-1ms clkdz:out std_logic;-0.5s clkwarn: out std_logic; clk1out:out std_logic; clk2out:out std_logic; clk3out:out std_logic; clk4out:out std_logic; clk5out:out std_logic; clk6out:out std_logic -clkwarn:out std_logic );end fenpinqi;architecture div of fenpinqi issignal tmp1:integer range 0 to 24999;-1mssignal clktmp1: std_logic;signal tmp2:integer range 0 to 124999;-5mssignal clktmp2: std_logic;signal tmp3:integer range 0 to 249999;-10mssignal clktmp3: std_logic;signal tmp4:integer range 0 to 24999999;-1s moni 20mssignal clktmp4: std_logic;signal tmp5:integer range 0 to 12499999;-0.5s moni 10mssignal clktmp5: std_logic;signal tmp6:integer range 0 to 62499;-1s moni 20mssignal clktmp6: std_logic;signal tmp7:integer range 0 to 47778;-1signal clktmp7: std_logic;signal tmp8:integer range 0 to 42565;-2signal clktmp8: std_logic;signal tmp9:integer range 0 to 37921;-3signal clktmp9: std_logic;signal tmp10:integer range 0 to 35793;-4signal clktmp10: std_logic;signal tmp11:integer range 0 to 31888;-5signal clktmp11: std_logic;signal tmp12:integer range 0 to 28409;-6signal clktmp12: std_logic;signal tmp13:integer range 0 to 2499999;-fssignal clktmp13: std_logic;-signal tmp5: integer range 0 to 499;-signal clktmp5: std_logic;beginp1:process(clk)-1msbeginif (clkevent and clk=1) thenif tmp1=24999 thentmp1=0;clktmp1=not clktmp1;elsetmp1=tmp1+1;end if;end if;end process;p2:process(clk)-5msbeginif (clkevent and clk=1) thenif tmp2=124999 thentmp2=0;clktmp2=not clktmp2;elsetmp2=tmp2+1;end if;end if;end process;p3:process(clk)-10msbeginif (clkevent and clk=1) thenif tmp3=249999 thentmp3=0;clktmp3=not clktmp3;elsetmp3=tmp3+1;end if;end if;end process;p4:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp4=24999999 thentmp4=0;clktmp4=not clktmp4;elsetmp4=tmp4+1;end if;end if;end process;p5:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp5=12499999 thentmp5=0;clktmp5=not clktmp5;elsetmp5=tmp5+1;end if;end if;end process;p6:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp6=62499 thentmp6=0;clktmp6=not clktmp6;elsetmp6=tmp6+1;end if;end if;end process;p7:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp7=47778 thentmp7=0;clktmp7=not clktmp7;elsetmp7=tmp7+1;end if;end if;end process;p8:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp8=42565 thentmp8=0;clktmp8=not clktmp8;elsetmp8=tmp8+1;end if;end if;end process;p9:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp9=37921 thentmp9=0;clktmp9=not clktmp9;elsetmp9=tmp9+1;end if;end if;end process;p10:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp10=35793 thentmp10=0;clktmp10=not clktmp10;elsetmp10=tmp10+1;end if;end if;end process;p11:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp11=31888 thentmp11=0;clktmp11=not clktmp11;elsetmp11=tmp11+1;end if;end if;end process;p12:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp12=28409 thentmp12=0;clktmp12=not clktmp12;elsetmp12=tmp12+1;end if;end if;end process;p13:process(clk)-1s moni 20msbeginif (clkevent and clk=1) thenif tmp13=2499999 thentmp13=0;clktmp13=not clktmp13;elsetmp13=tmp13+1;end if;end if;end process;cpout=clktmp1;-1msclkconout=clktmp2;-5msclkkeyout=clktmp3;-10msclksegout=clktmp4;-1sclkdz=clktmp5;clkwarn=clktmp6;-clkwarn=clktmp5;clk1out=clktmp7;clk2out=clktmp8;clk3out=clktmp9;clk4out=clktmp10;clk5out=clktmp11;clk6out=clktmp12;clkfs=clktmp13;end div;仿真图Clk为输入时钟信号,clk1out,clk2out,clk3out,clk4out,clk5out,clk6out,, clkwarn 是用于报警模块的输出时钟信号,clkdz,clkfs是用于点显示模块的输出时钟信号,clkonout,clkeyout,clkegout,cpout都是输出时钟信号。2.按键模块这一模块由2个程序构成,一个是防抖程序,一个是各种按键信号产生的程序,后者产生的控制信号将输入控制模块,完成控制输入。程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity keypad isport( clkkey:in std_logic; buttonin: in std_logic; pausein: in std_logic; startin: in std_logic; buttonout: out std_logic; pauseout: out std_logic; startout: out std_logic );end keypad;architecture key_choose of keypad issignal resettmp1,resettmp2,resettmp3,resettmp4,resettmp5,resettmp6:std_logic;beginp1:process(clkkey,buttonin,pausein,startin) begin if(clkkeyevent and clkkey=1) then resettmp2=resettmp1; resettmp1=buttonin; end if; buttonout=clkkey and resettmp1 and (not resettmp2); end process; p2:process(clkkey,pausein) begin if(clkkeyevent and clkkey=1) then resettmp4=resettmp3; resettmp3=pausein; end if; pauseout=clkkey and resettmp3 and (not resettmp4); end process; p3:process(clkkey,startin) begin if(clkkeyevent and clkkey=1) then resettmp6=resettmp5; resettmp5=startin; end if; startout=clkkey and resettmp5 and (not resettmp6); end process;end key_choose;仿真图Pause是暂停按键,start是开始按键,Pausein是暂停输入信号,pauseout是暂停输出信号,startin是开始输入信号,startout是开始输出信号。3.模式选择模块将用户的选择信息传递到控制模块。一共有5种模式可以选择,通过一个按钮实现。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_signed.all;entity mode isport(s0,s1,s2:out integer range 0 to 3;clkcon: in std_logic;button: in std_logic;pause: in std_logic;start: in std_logic;signmode:in std_logic;modeview:out std_logic_vector(2 downto 0);psignout:out std_logic;iout:out integer range 1 to 5;ssignout: out std_logic);end mode;architecture modeshow of mode issignal i: integer range 1 to 5;signal g: integer range 1 to 2;signal h: integer range 1 to 2;beginp1:process(clkcon,button)begin if (clkconevent and clkcon=1 and signmode=1) theni=1;modeview=000;s0=0;s1=0;s2s0=1;s1=0;s2=0;modeview=100;is0=2;s1=0;s2=0;modeview=010;is0=3;s1=0;s2=0;modeview=001;is0=2;s1=3;s2=0;modeview=011;is0=1;s1=2;s2=3;modeview=111;inull;end case;end if; end if;end process;p2:process(clkcon,pause)-1 work 2 restartbegin if (clkconevent and clkcon=1 and pause=1) thencase g is when 1=psignout=1;gpsignout=0;gpsignoutssignout=1;hssignout=0;hssignout=0; end case; end if; end process; iout=i;endmodeshow;仿真图5种模式选择,分别用000表示等待,001表示脱水,010表示漂洗,100表示洗涤,011表示漂洗和脱水,111表示洗涤,漂洗和脱水全过程。4.点阵显示模块动画显示洗衣状态library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity rollcount isport (cntclk: in std_logic;-1ms movclk: in std_logic;-0.5s fsclk:in std_logic;-100ms insign: in std_logic;-waterin outsign:in std_logic;-waterout lausign:in std_logic;-laundry potsign:in std_logic;-potch drysign:in std_logic;-dry row: out std_logic_vector(7 downto 0); colr:out std_logic_vector(7 downto 0); move1out:out integer range 0 to 7; move2out:out integer range 0 to 1; cnt8out: out integer range 0 to 7; colg:out std_logic_vector(7 downto 0) );end rollcount;architecture roll of rollcount issignal count:integer range 0 to 7;signal count1:integer range 0 to 7;signal count2:integer range 0 to 1;signal count3:integer range 0 to 23;signal cnt8:integer range 0 to 7;-choose the rowsignal move1:integer range 0 to 7;signal move2:integer range 0 to 1;signal move3:integer range 0 to 23;type r0 is array(14 downto 0)of std_logic_vector(7 downto 0);-15*8signal array1:r0;-waterinsignal array6:r0;type r1 is array(7 downto 0)of std_logic_vector(30 downto 0);-78*8signal array2:r1;-laundrysignal array7:r1;type r3 is array(7 downto 0)of std_logic_vector(14 downto 0);-8*78signal array3:r3;-potchsignal array8:r3;type r2 is array(7 downto 0)of std_logic_vector(7 downto 0);-8*78signal array4:r2;-dry1signal array5:r2;-dry2signal array9:r2;signal array10:r2;begin array1=(-waterin-waterout00000000,00000000,00000000,00000000,00000000,00000000,00000000,01100110,00000000,00000000,01100110,00000000,00000000,01100110,00000000);array6=(-waterin-waterout00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,10011001,00000000,00000000,10011001,00000000,00000000,10011001);array2=(-laundry 0000000000000000000000000000000, 0111111011100111000011100111111, 0000000011111111000000000000000, 0000000011111111000000000000000, 0000000000111100000000000000000, 0000000000111100000000000000000, 0000000000111100000000000000000, 0110011000111100000000000110011);array7=(-laundry 0000000000000000000000000000000, 0000000011100111000000000000000, 0111111000011000000011100111111, 0111111000000000000011100111111, 0110011000000000000011100110011, 0110011000000000001111100110011, 0110011000000000011111100110011, 0000000000000000001111100000000);array3=(-potch011001100110011, 100110011001100, 000000000000000, 000000000000000, 000000000000000, 000000000000000,011001100110011, 100110011001100);array8=(-potch000000000000000, 000000000000000, 000000000000000, 011001100110011, 100110011001100, 000000000000000,011001100110011, 100110011001100);array4=(-dry100011000,00010000,00010000,00011000,00011000,00001000,00001000,00011000);array9=(-dry100000000,00000000,10000000,11111111,00011001,00000000,00000000,00000000);array5=(-dry200000000,00000010,00000101,00011000,00011000,10100000,01000000,00000000); array10=(-dry200100000,01000000,00100000,00011000,00011000,00000100,00000010,00000100); p1:process(movclk)-move1 begin if(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论