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

下载本文档

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

文档简介

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

2、4;”,定时到则停止,同时发出提示音。基本要求:1、设计一个电子定时器,控制洗衣机作如下运转:定时启动®正转20秒®暂停10秒®反转20秒®暂停10秒®定时未到回到“正转20秒®暂停10秒®”,定时到则停止;2、若定时到,则停机发出音响信号;3、用两个数码管显示洗涤的预置时间(分钟数),按倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由“开始”信号开始;4、三只LED灯表示“正转”、“反转”、“暂停”三个状态。主要参考资料:1 潘松著.EDA技术实用教程(第二版). 北京:科学出版社,2005.2 康华光主编.电子

3、技术基础 模拟部分. 北京:高教出版社,2006.3 阎石主编.数字电子技术基础. 北京:高教出版社,2003.完成期限 2014.3.7 指导教师 专业负责人 2014年 3月3日一、设计思想1.基本原理洗衣机控制器的设计主要是定时器的设计。由一片FPGA和外围电路构成了电器控制部分。FPGA接收键盘的控制命令,控制洗衣机的进水、排水、水位和洗衣机的工作状态、并控制显示工作状态以及设定直流电机速度、正反转控制、制动控制、起停控制和运动状态控制。对芯片的编程采用模块化的VHDL (硬件描述语言)进行设计,设计分为三层实现,顶层实现整个芯片的功能。顶层和中间层多数是由VHDL的元件例化语句实现。

4、中间层由无刷直流电机控制、运行模式选择、洗涤模式选择、定时器、显示控制、键盘扫描、水位控制以及对直流电机控制板进行速度设定、正反转控制、启停控制等模块组成,它们分别调用底层模块。定时到2.设计框图停止暂停10s反转20s暂停10s正转20s定时启动定时没到图1 设计框图用两位数码管预置洗涤时间(分钟数),洗涤过程在送入预置时间后开始运转,洗涤中按倒计时方式对洗涤过程作计时显示,用LED表示电动机的正、反转,如果定时时间到,则停机并发出音响信号。二、设计步骤和调试过程1、模块设计和相应模块代码洗衣机控制器电路主要有五大部分组成,包括:减法计数器、时序控制电路、预置时间和编码电路、数码管显示、译码

5、器组成。(1)预设时间和编码电路:本模块将输入的四位时间信号编码成八位二进制数输出到减法计数器电路。library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;  entity settime is    port    (  load:in std_logic;  time_input:

6、in std_logic_vector(3 downto 0); time_set:out std_logic_vector(7 downto 0) ); end settime;  architecture settime of settime is      signal p1:std_logic_vector(7 downto 0); beg

7、in         process(load)  begin                  if(load'event and load='1')  then        

8、60;             case time_input is                      when "0000"=>p1<="00000000"  

9、; when "0001"=>p1<="00000001"   when "0010"=>p1<="00000010" when "0011"=>p1<="00000011" when "0100"=>p1<="00000100"when "0101"=>p1<=&qu

10、ot;00000101"when "0110"=>p1<="00000110"when "0111"=>p1<="00000111" when "1000"=>p1<="00001000"when "1001"=>p1<="00001001"when others=>p1<="00000000&qu

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

12、ibrary ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity counter is     port     (        clk,start:in std_logic;    

13、60;   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 o

14、f counter is     begin          process(clk)variable time_second:integer range 0 to 59 :=59;             begin  

15、60;          if(clk'event and clk='1')   then                  if(start='0')  then     

16、60;               if(time_remain(7 downto 0)=0) then                       time_remain<=time_set;

17、else                       time_remain(7 downto 4)<=time_remain(3 downto 0);              &#

18、160;       time_remain(3 downto 0)<=time_set(3 downto 0);end if;                    time_second:=59; time_over<='1' 

19、else                    if(time_over='1') then                        if

20、(time_second=0 and time_remain(7 downto 0)=0)                           then           

21、60;                 time_over<='0'else                           

22、0; if(time_second=0) then                                if(time_remain(3 downto 0)=0) thentime_remain(7 downto

23、0;4)<=time_remain(7 downto 4)-1; time_remain(3 downto 0)<="1001"time_second:=59;else  time_remain(7 downto 4)<=time_remain(7 downto 4);   time_remain(3 downto 0)<=time_remain(3 downto 0)-1;

24、0;                                    time_second:=59;           

25、 end if;                             else                  &

26、#160;            time_second:=time_second-1;                      end if;        

27、0;       end if;end if;         end if;    end if;end process; end counter; 图3减法计数器模块源仿真(3)数码管显示模块:根据课程设计要求,必须将洗衣机的工作状态及工作时间在数码管和指示灯上显示出来,此模块是用来控制洗衣机的工作状态及工作的频率

28、,并把工作状态及工作时间显示出来。a,b,c,d,e,f,g分别对应数码管的七段,minute和second分别位选两个数码管,显示十位和个位。library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity showtime is     port     (     

29、;  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  

30、60;  ); end showtime; architecture showtime of showtime is     signal temp:std_logic_vector(6 downto 0);     signal bcd:std_logic_vector(3 downto 0);    &#

31、160;signal choose:std_logic;     begin         process(clk)         begin             if(clk'event and

32、0;clk='1')                 then                 choose<=not choose;        

33、;         if(choose='1')                     then               

34、60;     minute<='0'second<='1'                     bcd<= time_remain(7 downto 4);        &

35、#160;        else                     minute<='1'second<='0'            &

36、#160;        bcd<= time_remain(3 downto 0);                 end if;             end

37、0;if;         end process;         process(bcd)             begin            

38、60;    case bcd is                 when  "0000"=>temp<="1111110"              &

39、#160; when  "0001"=>temp<="0110000"when  "0010"=>temp<="1101101"                 when  "0011"=>temp<="11110

40、01"                when  "0100"=>temp<="0110011"                when  "0101"=&g

41、t;temp<="1011011"                when  "0110"=>temp<="1011111"                 when

42、60; "0111"=>temp<="1110000"                when  "1000"=>temp<="1111111"             

43、60;  when  "1001"=>temp<="1111011"                when  others=>temp<="1111011"           

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

45、#160;ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity analyse is     port     (       clk,start,time_over:in std_logic;       out_1,ou

46、t_2:out std_logic     ); end analyse; architecture analyse of analyse is     begin         process(clk)         variable

47、  state:std_logic;         variable  wash_time:integer:=0;         variable  wait_time:integer:=0;         begin    

48、;         if(clk'event and clk='1')                  then              &#

49、160;   if(start='0')                      then                    &

50、#160; wash_time:=0;                      wait_time:=0;                      

51、;state:='0'                      out_1<='0'out_2<='0'                  

52、;else                      if(time_over='1')                       

53、   then                          if(wash_time=20)                 

54、0;            then                              if(wait_time=10)    &#

55、160;                             then                   

56、0;              wash_time:=0;                                 

57、60;state:=not state;                              else               &

58、#160;                  wait_time:=wait_time+1;                           &#

59、160;  end if;                          else                  

60、0;           wash_time:=wash_time+1;                              wait_time:=0;  

61、0;                       end if;                      end if;

62、0;                     if (wash_time=20)                         

63、 then                          out_1<='0'out_2<='0'               &#

64、160;      else                          if(state='0')             &

65、#160;                then                              out_1<='

66、1'out_2<='0'                          else                   

67、;           out_1<='0'out_2<='1'                          end if;    

68、;                  end if;                  end if;          

69、;    end if;          end process; end analyse;图5时序电路模块仿真:(5)译码器模块:接收电机运行状态信号,译码后实时控制电机的正传、反转和暂停。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;  archite

温馨提示

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

评论

0/150

提交评论