1、主分频器、主控制器、洗涤定时器和水流控制器。洗衣机洗涤控制电路的结构框图主分频器主分频器用来产生0.1秒的时钟供主控制器使用。本方案DE2板自带时钟 ,其振荡频率为50MHz。这样,主分频器的分频系数为5M。现采用3个分频器构成主分频器的分频电路。3个分频器是1k分频器、1k分频器和5分频器。主分频器的结构如下图所示。主分频器的结构三、洗衣机洗涤控制电路的算法状态机图描述1主控制器算法状态机图描述根据主控制器的工作要求,洗衣机洗涤时的工作状态共有以下9种:标准15分钟 标准10分钟标准5分钟 轻柔15分钟轻柔10分钟 轻柔5分钟强洗15分钟 强洗10分钟强洗5分钟 1)模式选择控制状态机图2)
2、 定时选择控制状态机图3) 启/停控制算法状态机图描述2洗涤定时器算法状态机图描述洗涤定时器有3种状态:停止状态(IDLE)、计时状态(INCCOUNT)和暂停状态(TMP_STOP)。3水流控制器算法状态机图描述该状态机图有3种状态:停止状态(STOP)、电机接通定时计数状态(ON_TIME)和电机断开定时计数状态(OFF_TIME)。四、洗衣机洗涤控制电路的VHDL语言描述1主分频器timectr_clkdiv模块主分频器的功能是将50M Hz的主频分频为10 Hz的时钟。该模块由3个进程组成,其VHDL语言描述的程序清单如下:LIBRARY IEEE;USE IEEE.STD_LOGIC
3、_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY timectr_clkdiv IS PORT(sysclk:IN STD_LOGIC; clk_01:OUT STD_LOGIC);END timectr_clkdiv;ARCHITECTURE rtl OF timectr_clkdiv IS SIGNAL div1:STD_LOGIC_VECTOR(9 DOWNTO 0):=0000000000; -divide by 1k counter SIGNAL div2: SIGNAL div3:STD_LOGIC_VECTOR(2 DOWNTO 0
4、):000 -divide by 5 counter SIGNAL clk1,clk2:STD_LOGIC;BEGIN div_1k:PROCESS(sysclk) BEGIN IF(sysclkEVENT AND sysclk=1)THEN IF(div1=1111100111)THEN div1 ELSE div1=div1+1; END IF; END IF; END PROCESS; clk1=div1(999);PROCESS(clk1) IF(clk1EVENT AND clk1= IF(div2=)THEN div2 ELSE div2=div2+1; clk2=div2(999
5、); div_5:PROCESS(clk2) IF(clk2EVENT AND clk2= IF(div3=100)THEN div3 ELSE div3=div3+1; clk_01=div3(2);END rtl;div_5进程为5分频进程,div_1k进程为1000分频进程。50M Hz主频经该3个进程 串行分频就得到10 Hz的时钟clk_01。2定时器控制timer_ctr模块如前所述,定时器控制timer_ctr模块的功能是根据启/停按键(start_stop)、模式选择按键(mode_sel)和定时选择按键(time_sel)的不同输入状态,产生对应的控制信号输出,其VHDL语言
6、描述的程序清单如下。USE IEEE.STD_LOGIC_ARITH.ALL;ENTITY timer_ctr IS PORT(reset,sysclk,start_stop,mode_sel,time_sel,timer_down: s5min_out,s10min_out,s15min_out,start_out:OUT STD_LOGIC; b_out,j_out,z_out:END timer_ctr;ARCHITECTURE rtl OF timer_ctr IS TYPE state1TYPE IS (s_b,s_z,s_j); TYPE state2TYPE IS (s_15mi
7、n,s_10min,s_5min); TYPE state3TYPE IS (s_start,s_stop); SIGNAL state1,nextstate1:state1TYPE; SIGNAL state2,nextstate2:state2TYPE; SIGNAL state3,nextstate3:state3TYPE; SIGNAL start_stop_rising,start_stop_dlayed,setstart,clrstart: SIGNAL mode_sel_dlayed,modesel_rising,time_sel_dlayed,timesel_rising, t
8、imer_down_rising: SIGNAL set_5min,set_10min,set_15min,start,set_b,set_j,set_z, timer_down_dlayed: modesel_rising=mode_sel AND (NOT mode_sel_dlayed); timesel_rising=time_sel AND (NOT time_sel_dlayed); start_stop_rising=start_stop AND (NOT start_stop_dlayed); mode_ctr:PROCESS(modesel_rising,state1,tim
9、er_down) set_b=0set_jset_z IF(timer_down=) THEN set_bnextstate1=s_b; ELSIF(modesel_rising=) THEN nextstate1 set_z) THEN set_z set_j) THEN set_j END CASE;END PROCESS;time_ctr:PROCESS(timesel_rising,state2,timer_down) set_15min set_10minset_5min) THEN set_15minnextstate2=s_15min; ELSIF(timesel_rising=
10、) THEN nextstate2 nextstate2) THEN set_10min set_5min) THEN set_5mintimer_down_rising=timer_down AND (NOT timer_down_dlayed); start_ctr:PROCESS(start_stop_rising,state3,timer_down) setstartclrstart IF(start_stop_rising=) THEN nextstate3=s_start;setstart nextstate3 IF(timer_down_rising=) THEN clrstar
11、tnextstate3ELSIF(start_stop_rising= nextstate3time_ctr_update:PROCESS(reset,sysclk,timer_down_rising) IF(reset=) THEN state1 state2 state3start_stop_dlayed ELSIF(sysclk) THEN=nextstate1;state2=nextstate2;state3=nextstate3;IF(set_b=) THEN b_outELSE b_outEND IF; IF(set_z=) THEN z_outELSE z_out IF(set_
12、j=) THEN j_outELSE j_out IF(set_15min=) THEN s15min_outELSE s15min_out IF(set_10min=) THEN s10min_outELSE s10min_out IF(set_5min=) THEN s5min_outELSE s5min_out) THEN start_out ELSIF(clrstart= ELSIF(setstart= mode_sel_dlayed=mode_sel; time_sel_dlayed=time_sel; start_stop_dlayed=start_stop; timer_down
13、_dlayed=timer_down;该模块由4个进程组成。mode_ctr进程是模式选择控制进程,对应图的模式选择控制状态机图;timer_cnt进程是定时选择控制进程,对应图的定时选择控制状态机图;start_ctr进程是启/停控制进程,对应图的启/停控制算法状态机图;最后一个进程是time_ctr_update进程,它的功能是根据上述3个进程中不同的控制标志输出,在该进程中对输出控制信号进行刷新,其刷新频率为系统主时钟频率(50M Hz),这样就可确保控制的精度。3定时器timer_count模块定时器timer_count模块的功能是根据定时控制输出,对洗衣机的洗涤时间进行定时控制。它
14、由3个进程构成,其VHDL语言描述的程序清单如下:ENTITY timer_count IS PORT(reset,sysclk,clk_01,time_sel: s5min_in,s10min_in,s15min_in,start_in: timer_down_out,timer_on_out:END timer_count;ARCHITECTURE rtl OF timer_count IS COMPONENT cnt10a1 PORT(reset,clk: carry: END COMPONENT;COMPONENT cnt60a ca60:TYPE stateTYPE IS (IDLE
15、,INCOUNT,TMP_STOP); SIGNAL state,nextstate:stateTYPE; SIGNAL set_timer_on,set_timer_down,ca10,s1min,s1min_dlayed,s1min_rising,count_inc,count_clr: SIGNAL time_sel_dlayed,time_sel_rising,setdown,clrdown,seton,clron,timer_on,timer_down, timer_down_dlayed,timer_down_rising,start1,reset1,clk_01_s: SIGNA
16、L count,count_u:STD_LOGIC_VECTOR(3 DOWNTO 0); s1min_rising=s1min AND (NOT s1min_dlayed); time_sel_rising timer_down_rising count_ctr:PROCESS(s1min_rising,state,start_in,count) BEGIN setdownclrdownsetonclroncount_inccount_clr IF(start_in= AND timer_down=nextstate=INCOUNT; clronIF(start_in=) THEN clro
17、n=TMP_STOP; IF(s1min_rising= IF(count/=count_u) THEN count_inc ELSE setdown count_clr nextstate) THEN nextstate ELSE nextstateupdate:PROCESS(reset,sysclk) AND (NOT timer_down)= states1min_dlayedtime_sel_dlayed count0000=nextstate; IF(seton=) THEN timer_onELSIF(clron= IF(clrdown=) THEN timer_downELSI
18、F (setdown= timer_down IF(count_inc=count+1; ELSIF(count_clr=) THEN count=s1min; timer_down_out=timer_down ;timer_on_out=timer_on;INIT:PROCESS(reset,time_sel_rising,timer_down_rising) or timer_down_rising= count_u1110 ELSIF(time_sel_risingEVENT AND time_sel_rising= IF(s15min_in=) THEN count_u1001 EL
19、SIF(s10min_in=0100ELSIF(s5min_in=clk_01_s=clk_01 AND start_in;reset1=reset AND (NOT timer_down);u0:cnt10a1 PORT MAP(reset1,clk_01_s,ca10);u1:cnt60a PORT MAP(reset1,ca10,s1min);count_cnt进程是定时计时进程,根据定时选择所确定的定时时间进行计时控制,它对应于图的洗涤定时算法状态机图。update进程是一个刷新进程,它根据count_ctr进程的输出控制标志,对输出控制信号进行刷新。INIT进程是对本次定时器赋初值的进程。定时器根据所赋初值的时间,实现洗涤时间的控制。在timer_count清单中还含有10分频器和60分频器元件,这主要是为在本模块中得到分时钟s1min。4水流周期控制timeronoff_ctr模块 水流周期控制timeronoff_ctr模块的功能是控制洗涤电机的
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1