EDA课程设计洗衣机控制器_第1页
EDA课程设计洗衣机控制器_第2页
EDA课程设计洗衣机控制器_第3页
EDA课程设计洗衣机控制器_第4页
EDA课程设计洗衣机控制器_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

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

文档简介

1、东北石油大学课程设计课 程 EDA 技术课程设计 题 目洗衣机控制器院 系电子科学学院专业班级电子信息工程学生姓名学生学号指导教师2014 年 3 月 7 日东北石油大学课程设计任务书课程 EDA 技术课程设计题目 洗衣机控制器专业 电子信息工程 学号主要容、基本要求、主要参考资料等20秒设计一个洗衣机控制器,要求洗衣机有正转、反转、暂停三种状态。设定洗衣机的工作时间,要洗 衣机在工作时间完成:定时启动正转20秒 暂停10秒 反转 20秒 暂停10秒 定时未到回到“正转暂停 10秒 ”,定时到则停止,同时发出提示音。基本要求:1、设计一个电子定时器,控制洗衣机作如下运转:定时启动正转 20秒

2、暂停10秒 反转 20秒停 10秒 定时未到回到“正转 20秒 暂停 10秒 ”,定时到则停止;2、若定时到,则停机发出音响信号;3、用两个数码管显示洗涤的预置时间(分钟数) ,按倒计时方式对洗涤过程作计时显示,直到时间到 停机;洗涤过程由“开始”信号开始;4、三只 LED灯表示“正转”、“反转”、“暂停”三个状态。主要参考资料:1 松著.EDA技术实用教程 (第二版 ). :科学 ,2005.2 康华光主编 . 电子技术基础 模拟部分 . :高教 ,2006.3 阎石主编 .数字电子技术基础 . :高教 ,2003.完成期限 2014.3.7指导教师专业负责人2014年 3 月3日一、设计思

3、想1. 基本原理洗衣机控制器的设计主要是定时器的设计。由一片 FPGA和外围电路构成了 电器控制部分。 FPGA接收键盘的控制命令,控制洗衣机的进水、排水、水位和 洗衣机的工作状态、并控制显示工作状态以及设定直流电机速度、正反转控制、 制动控制、起停控制和运动状态控制。对芯片的编程采用模块化的VHDL (硬件描述语言 ) 进行设计,设计分为三层实现,顶层实现整个芯片的功能。顶层和中 间层多数是由 VHDL的元件例化语句实现。中间层由无刷直流电机控制、运行模 式选择、洗涤模式选择、定时器、显示控制、键盘扫描、水位控制以及对直流 电机控制板进行速度设定、正反转控制、启停控制等模块组成,它们分别调用

4、 底层模块。2. 设计框图图 1 设计框图用两位数码管预置洗涤时间 (分钟数 ),洗涤过程在送入预置时间后开始运 转,洗涤中按倒计时方式对洗涤过程作计时显示,用LED 表示电动机的正、反转,如果定时时间到,则停机并发出音响信号。二、设计步骤和调试过程1、模块设计和相应模块代码洗衣机控制器电路主要有五大部分组成,包括:减法计数器、时序控制电 路、预置时间和编码电路、数码管显示、译码器组成。(1)预设时间和编码电路:本模块将输入的四位时间信号编码成八位二进制数 输出到减法计数器电路。library ieee;use ieee.std_logic_1164.all;use ieee.std_logi

5、c_unsigned.all;entity settime is port (load:in std_logic;time_input:in std_logic_vector(3 downto 0);time_set:out std_logic_vector(7 downto 0) );end settime;architecture settime of settime issignal p1:std_logic_vector(7 downto 0); beginprocess(load)beginif(load'event and load='1') thencas

6、e time_input iswhen "0000"=>p1<="00000000"when "0001"=>p1<="00000001"when "0010"=>p1<="00000010"when "0011"=>p1<="00000011"when "0100"=>p1<="00000100"when "0101"

7、;=>p1<="00000101"when "0110"=>p1<="00000110"when "0111"=>p1<="00000111"when "1000"=>p1<="00001000"when "1001"=>p1<="00001001"when others=>p1<="00000000"end case;end

8、 if;end processtime_set<=p1;end settime;图 2 预设时间和编码仿真用 K1、K2、K3、K4 给 time_input 输入一个二进制数 0111,让 load 有效,输出 time_set 为 00000111。(2)减法计数器模块 : 由于洗衣机有工作时间,必须要一模块来控制它的工作 时间围,当洗衣机开始工作后,减法计数器即会实现减数功能,直到时间减到 零,洗衣机便停止工作。当出现系统运行结束信号 time_over 时, 蜂鸣器报警洗 衣机工作结束。library ieee;use ieee.std_logic_1164.all;use ie

9、ee.std_logic_unsigned.all;entity counter isportclk,start:in std_logic;time_set:in std_logic_vector(7 downto 0);time_remain:buffer std_logic_vector(7 downto 0);time_over:buffer std_logic);end counter;architecture counter of counter isbeginvariable time_second:integer range 0 to 59 :=59;beginif(clk

10、9;event and clk='1')thenif(start='0')thenif(time_remain(7 downto 0)=0)then time_remain<=time_set;elsetime_remain(7 downto 4)<=time_remain(3 downto 0);time_remain(3 downto 0)<=time_set(3 downto0);end if;time_second:=59; time_over<='1'elseif(time_over='1')th

11、enif(time_second=0 and time_remain(7 downto0)=0)thentime_over<='0'elseif(time_second=0)thenif(time_remain(3 downto 0)=0)thentime_remain(7 downto 4)<=time_remain(7 downto 4)-1;time_remain(3 downto 0)<="1001"time_second:=59;elsetime_remain(7 downto 4)<=time_remain(7 downt

12、o 4);time_remain(3 downto 0)<=time_remain(3 downto 0)-1;time_second:=59;end if;elsetime_second:=time_second-1;end if;end if;end if;end if;end if;end counter;图 3 减法计数器模块源仿真(3) 数码管显示模块:根据课程设计要求,必须将洗衣机的工作状态及工 作时间在数码管和指示灯上显示出来,此模块是用来控制洗衣机的工作状态及 工作的频率, 并把工作状态及工作时间显示出来。 a,b,c,d,e,f,g 分别对应数码 管的七段, minut

13、e 和 second 分别位选两个数码管,显示十位和个位。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity showtime isport (time_remain:in std_logic_vector(7 downto 0);clk:in std_logic;minute,second:out std_logic;a,b,c,d,e,f,g:out std_logic);end showtime;architecture showtime of showtime issignal

14、 temp:std_logic_vector(6 downto 0);signal bcd:std_logic_vector(3 downto 0);signal choose:std_logic;begin process(clk) beginif(clk'event and clk='1')thenchoose<=not choose; if(choose='1') then minute<='0'second<='1' bcd<= time_remain(7 downto 4); elsemi

15、nute<='1'second<='0' bcd<= time_remain(3 downto 0); end if;end if;end process;begincase bcd is when "0000"=>temp<="1111110"when "0001"=>temp<="0110000"when "0010"=>temp<="1101101"when "0011&qu

16、ot;=>temp<="1111001"when "0100"=>temp<="0110011"when "0101"=>temp<="1011011"when "0110"=>temp<="1011111"when "0111"=>temp<="1110000"when "1000"=>temp<="1111111

17、"when "1001"=>temp<="1111011"when others=>temp<="1111011"e<=temp(2) ;end case;a<=temp(6) ; b<=temp(5) ; c<=temp(4) ; d<=temp(3) ;f<=temp(1) ; g<=temp(0)end processend showtime图 4 数码管模块仿真4)时序电路模块:接收运行起止信号,安排电机运行状态并编码输出 library ieee;u

18、se ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity analyse isport (clk,start,time_over:in std_logic;out_1,out_2:out std_logic );end analyse;architecture analyse of analyse isbeginprocess(clk)variable state:std_logic;variable wash_time:integer:=0;variable wait_time:integer:=0;beginif(

19、clk'event and clk='1')thenif(start='0')thenwash_time:=0;wait_time:=0;state:='0' out_1<='0'out_2<='0'elseif(time_over='1')thenif(wash_time=20)then if(wait_time=10)thenwash_time:=0;state:=not state;elsewait_time:=wait_time+1;end if;else wash_ti

20、me:=wash_time+1; wait_time:=0;end if;end if;if (wash_time=20)then out_1<='0'out_2<='0'elseif(state='0')thenout_1<='1'out_2<='0'elseout_1<='0'out_2<='1'end if;end if;end if;end if;end process; end analyse;图 5 时序电路模块仿真:(5)译码器模块:

21、接收电机运行状态信号,译码后实时控制电机的正传、 反转和暂停。library ieee;use ieee.std_logic_1164.all;entity move is port (out_1,out_2:in std_logic;REV,RUN,PAUSE:buffer std_logic );end move;architecture move of move issignal choose:std_logic_vector(1 downto 0);beginchoose(1)<=out_1;choose(0)<=out_2;process(choose)begin cas

22、e choose iswhen "00"=>REV<='0'RUN<='0'PAUSE<='1'when "10"=>REV<='0'RUN<='1'PAUSE<='0'when "01"=>REV<='1'RUN<='0'PAUSE<='0'when others=>REV<='0'RUN&l

23、t;='0'PAUSE<='0'end case;REV<=out_2;RUN<=out_1;PAUSE<=not(out_1 or out_2);end process;end move;图 6 译码器模块仿真:2、仿真及仿真结果分析当预置号时间,启动 start ,数码管显示预置时间,电机开始以正转 =暂停 =反转=暂停为周期进行循环,一个周期正好费时一分钟,一个周期结束,数 码管显示减一,依次循环,直至数码管显示时间为零,洗衣结束。图 7 总体仿真3、实验调试结果电路设计完成以后,按照预定设计,输入相应数据,三只LED 灯按照设定时间规律间断性亮起,数码管也显示输入时间并按减数计时产生相应的数字

温馨提示

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

评论

0/150

提交评论