eda 洗衣机控制
东 北 石 油 大 学
课 程 设 计
2012年 3 月2日
eda 洗衣机控制
东北石油大学课程设计任务书
课程 EDA技术课程设计 题目 洗衣机控制器 专业 电子信息工程
姓名 姜长剑 学号080901140922
主要内容、基本要求、主要参考资料等 主要内容:
设计一个洗衣机控制器,要求洗衣机有正转、反转、暂停三种状态。设定洗衣机的工作时间,要洗衣机在工作时间内完成:定时启动 正转20秒 暂停10秒 反转20秒 暂停10秒 定时未到回到“正转20秒 暂停10秒 ……”,定时到则停止,同时发出提示音。
基本要求:
1、设计一个电子定时器,控制洗衣机作如下运转:定时启动 正转20秒 暂停10秒 反转20秒 暂停10秒 定时未到回到“正转20秒 暂停10秒 ”,定时到则停止;
2、若定时到,则停机发出音响信号;
3、用两个数码管显示洗涤的预置时间(分钟数),按倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由“开始”信号开始;
4、三只LED灯表示“正转”、“反转”、“暂停”三个状态。 [1] 潘松著.EDA技术实用教程(第二版). 北京:科学出版社,2005. [2] 康华光主编.电子技术基础 模拟部分. 北京:高教出版社,2006. [3] 阎石主编.数字电子技术基础. 北京:高教出版社,2003.
完成期限 2012.3.12 指导教师 专业负责人
2012年 2月27日
eda 洗衣机控制
一、总体设计思想
1.基本原理
首先用电路控制三只LED显示洗衣机正转、反转、暂停三种状态。然后用电子定时器控制洗衣机设定的工作时间,以及正传和反转运行时间的控制。同时用两个数码管显示洗涤的预置时间(按分钟计数),按倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由“开始”信号开始;最后定时到则停止,同时用蜂鸣器发出提示音。通过各种开关组成控制电路,使洗衣机实现程序运转。 直至结束为止。 2.设计框图
洗衣机控制电路由定时输入模块,电机输出模块,电机时间控制模块,数字显示电路,倒计时模块以及报警器模块组成。
图一
eda 洗衣机控制
二、设计步骤和调试过程
1、总体设计电路 电路图如下所示:
图二 2、模块设计和相应模块程序 (1)定时输入模块:
shuru
shuhshudininst
dout[3..0]dout1[3..0]
eda 洗衣机控制
此模块是为了实现洗衣机能够定时输入的功能,保证洗衣机能够正常运行。 library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL; entity shuru is
Port ( shu : in std_logic; hshu: in std_logic; din : in std_logic;
dout:out std_logic_vector(3 downto 0);
dout1:out std_logic_vector(3 downto 0)); end shuru;
architecture Behavioral of shuru is
signal count: std_logic_vector(3 downto 0); signal count1: std_logic_vector(3 downto 0); signal count2: std_logic_vector(3 downto 0); signal count3: std_logic_vector(3 downto 0); begin
process(shu,hshu,din) begin
dout<=count; dout1<=count1; if din='1' then
dout<="1111";dout1<="1111"; elsif rising_edge(shu) then if count="1001" then count<="0000"; else
count<=count+1; end if; end if;
if rising_edge(hshu) then if count1="0110" then count1<="0000"; else
count1<=count1+1; end if; end if; end process; end Behavioral;
eda 洗衣机控制
(2)电机时间控制模块:
washmachine
clk
cd
inst
此模块由一个累加器和一个命令控制器组成,用来实现预置洗涤时间的功能,洗涤时间以分钟数为单位,用户可根据自己的需求来设定洗涤时间的长短。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL; entity washmachine is
Port ( clk : in std_logic; c :out std_logic; d :out std_logic); end washmachine;
architecture miao20 of washmachine is
signal count: std_logic_vector(2 downto 0); signal shi: integer range 0 to 60; begin
process(clk) begin
if rising_edge(clk) then if shi=60 then shi<=0;c<='1';
else shi<=shi+1;c<='0';
end if;
if count="101" then count<="000"; d<='1'; else
count<=count+1; d<='0'; end if; end if; end process;
eda 洗衣机控制
end miao20; (3)电机输出模块
dianji
cc
dd[1..0]deng[2..0]
inst
此模块是为了实现能够控制洗衣机电机时间达到正转、反转、暂停的功能。 library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL; entity dianji is Port (
cc :in std_logic;
dd :out std_logic_vector(1 downto 0); deng : out std_logic_vector(2 downto 0)); end dianji;
architecture di of dianji is
signal count : std_logic_vector(2 downto 0); signal dian : std_logic_vector(1 downto 0); signal deng1 : std_logic_vector(2 downto 0); begin
dd <= dian; deng<=deng1; process(cc) begin
if rising_edge(cc) then if count = "101" then count <= "000"; else