EDA课程设计洗衣机控制器.docx

上传人:b****5 文档编号:8339038 上传时间:2023-01-30 格式:DOCX 页数:14 大小:598.45KB
下载 相关 举报
EDA课程设计洗衣机控制器.docx_第1页
第1页 / 共14页
EDA课程设计洗衣机控制器.docx_第2页
第2页 / 共14页
EDA课程设计洗衣机控制器.docx_第3页
第3页 / 共14页
EDA课程设计洗衣机控制器.docx_第4页
第4页 / 共14页
EDA课程设计洗衣机控制器.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

EDA课程设计洗衣机控制器.docx

《EDA课程设计洗衣机控制器.docx》由会员分享,可在线阅读,更多相关《EDA课程设计洗衣机控制器.docx(14页珍藏版)》请在冰豆网上搜索。

EDA课程设计洗衣机控制器.docx

EDA课程设计洗衣机控制器

 

东北石油大学

课程设计

课程EDA技术课程设计

题目洗衣机控制器

院系电子科学学院

专业班级电子信息工程

学生姓名

学生学号

指导教师

 

 

2014年3月7日

东北石油大学课程设计任务书

课程EDA技术课程设计

题目洗衣机控制器

专业电子信息工程姓名学号

主要内容、基本要求、主要参考资料等

主要内容:

设计一个洗衣机控制器,要求洗衣机有正转、反转、暂停三种状态。

设定洗衣机的工作时间,要洗衣机在工作时间内完成:

定时启动正转20秒暂停10秒反转20秒暂停10秒定时未到回到“正转20秒暂停10秒……”,定时到则停止,同时发出提示音。

基本要求:

1、设计一个电子定时器,控制洗衣机作如下运转:

定时启动正转20秒暂停10秒反转20秒暂停10秒定时未到回到“正转20秒暂停10秒……”,定时到则停止;

2、若定时到,则停机发出音响信号;

3、用两个数码管显示洗涤的预置时间(分钟数),按倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由“开始”信号开始;

4、三只LED灯表示“正转”、“反转”、“暂停”三个状态。

主要参考资料:

[1]潘松著.EDA技术实用教程(第二版).北京:

科学出版社,2005.

[2]康华光主编.电子技术基础模拟部分.北京:

高教出版社,2006.

[3]阎石主编.数字电子技术基础.北京:

高教出版社,2003.

完成期限2014.3.7

指导教师

专业负责人

2014年3月3日

一、设计思想

1.基本原理

洗衣机控制器的设计主要是定时器的设计。

由一片FPGA和外围电路构成了电器控制部分。

FPGA接收键盘的控制命令,控制洗衣机的进水、排水、水位和洗衣机的工作状态、并控制显示工作状态以及设定直流电机速度、正反转控制、制动控制、起停控制和运动状态控制。

对芯片的编程采用模块化的VHDL(硬件描述语言)进行设计,设计分为三层实现,顶层实现整个芯片的功能。

顶层和中间层多数是由VHDL的元件例化语句实现。

中间层由无刷直流电机控制、运行模式选择、洗涤模式选择、定时器、显示控制、键盘扫描、水位控制以及对直流电机控制板进行速度设定、正反转控制、启停控制等模块组成,它们分别调用底层模块。

定时到

2.设计框图

停止

暂停10s

反转20s

暂停10s

正转20s

定时启动

定时没到

图1设计框图

用两位数码管预置洗涤时间(分钟数),洗涤过程在送入预置时间后开始运转,洗涤中按倒计时方式对洗涤过程作计时显示,用LED表示电动机的正、反转,如果定时时间到,则停机并发出音响信号。

二、设计步骤和调试过程

1、模块设计和相应模块代码

洗衣机控制器电路主要有五大部分组成,包括:

减法计数器、时序控制电路、预置时间和编码电路、数码管显示、译码器组成。

(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:

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); 

begin 

       process(load) 

 begin 

                if(load'event and load='1') 

 then 

                    case time_input is 

                    when "0000"=>p1<="00000000"; 

 when "0001"=>p1<="00000001"; 

 when "0010"=>p1<="00000010"; 

when "0011"=>p1<="00000011"; 

when "0100"=>p1<="00000100";

when "0101"=>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 if;

end process

 time_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 ieee.std_logic_unsigned.all; 

entity counter is     

port     

( 

       clk,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 is     

begin 

        process(clk)

variable time_second:

integer range 0 to 59 :

=59; 

            begin 

            if(clk'event and clk='1') 

 then 

                if(start='0') 

 then 

                   if(time_remain(7 downto 0)=0)

 then 

                      time_remain<=time_set;

else 

                      time_remain(7 downto 4)<=time_remain(3 downto 0);

                      time_remain(3 downto 0)<=time_set(3 downto 0);

end if; 

                   time_second:

=59; 

time_over<='1'; 

else 

                   if(time_over='1') 

then 

                      if(time_second=0 and time_remain(7 downto 0)=0)

                           then 

                            time_over<='0';

else 

                            if(time_second=0) 

then 

                              if(time_remain(3 downto 0)=0) 

then

time_remain(7 downto 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;   

                                  time_second:

=59;

           end if;

                             else 

                              time_second:

=time_second-1; 

                     end if; 

               end if;

end if;

         end if;

    end if;

end process; 

end counter; 

图3减法计数器模块源仿真

(3)数码管显示模块:

根据课程设计要求,必须将洗衣机的工作状态及工作时间在数码管和指示灯上显示出来,此模块是用来控制洗衣机的工作状态及工作的频率,并把工作状态及工作时间显示出来。

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     ( 

      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 is 

    signal temp:

std_logic_vector(6 downto 0);

     signal bcd:

std_logic_vector(3 downto 0);

     signal choose:

std_logic;

     begin 

        process(clk)

         begin 

            if(clk'event and clk='1')

                 then 

                choose<=not choose;

                 if(choose='1')

                     then 

                    minute<='0';second<='1'; 

                    bcd<= time_remain(7 downto 4);

                 else 

                    minute<='1';second<='0'; 

                    bcd<= time_remain(3 downto 0);

                 end if;

             end if;         

end process;

         process(bcd)

             begin 

                case bcd is 

                when  "0000"=>temp<="1111110";

                when  "0001"=>temp<="0110000";

when  "0010"=>temp<="1101101"; 

                when  "0011"=>temp<="1111001";

                when  "0100"=>temp<="0110011";

                when  "0101"=>temp<="1011011";

                when  "0110"=>temp<="1011111"; 

                when  "0111"=>temp<="1110000";

                when  "1000"=>temp<="1111111";

                when  "1001"=>temp<="1111011";

                when  others=>temp<="1111011"; 

               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 ieee.std_logic_1164.all; 

use ieee.std_logic_unsigned.all; entity analyse is

     port     ( 

      clk,start,time_over:

in std_logic;

       out_1,out_2:

out std_logic     ); 

end analyse; 

architecture analyse of analyse is

     begin 

        process(clk) 

        variable  state:

std_logic; 

        variable  wash_time:

integer:

=0;

         variable  wait_time:

integer:

=0;

         begin 

            if(clk'event and clk='1') 

                 then 

                 if(start='0') 

                     then 

                     wash_time:

=0;

                      wait_time:

=0;

                      state:

='0'; 

                     out_1<='0';out_2<='0';

                  else 

                     if(time_over='1')

                          then 

                         if(wash_time=20) 

                             then 

                             if(wait_time=10)

                                  then 

                                 wash_time:

=0; 

                                 state:

=not state; 

                             else 

                                 wait_time:

=wait_time+1;

                              end if; 

                         else 

                             wash_time:

=wash_time+1;

                              wait_time:

=0;

                          end if;

                      end if; 

                     if (wash_time=20) 

                         then 

                         out_1<='0';out_2<='0'; 

                     else 

                         if(state='0')

                              then 

                             out_1<='1';out_2<='0';

                          else 

                             out_1<='0';out_2<='1';

                          end if;

                      end if;

                  end if; 

             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;  

architecture move of move is 

   signal choose:

std_logic_vector(1 downto 0);

    begin 

   choose

(1)<=out_1;choose(0)<=out_2;

         process(choose)

          begin  

         case choose is 

         when "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<='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灯按照设定时间规律间断性亮起,数码管也显示输入时间并按减数计时产生相应的数字显示,直到到达预定时间停止工作显示零,实验设计达到预期效果。

三、结论及心得体会

通过这次课程设计我对FPGA的编程更加熟悉,对定时器和计数器的设计,让我更加明白时序组合门电路设计思路和方法。

而且自已独立思考与设计,使我初步掌握了VHDL的设计方法与一些技巧。

通过这个实验设计,我更加熟练地掌握了一些常见的数字芯片的设计方法,在设计中也参考和查阅了很多资料,从中学到不少课本上没有的东西。

只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正地更好去理解知识,从而提高自己的实际动手能力和独立思考的能力。

参考资料

[1]潘松著.EDA技术实用教程(第二版).北京:

科学出版社,2005.

[2]康华光主编.电子技术基础模拟部分.北京:

高教出版社,2006.

[3]阎石主编.数字电子技术基础.北京:

高教出版社,2003.

[4]谭会生,张昌凡.EDA技术及应用.西安:

西安电子科技大学出版社,2001.

[5]潘松,黄继业.EDA技术实用教程.北京:

科学出版社,2002.

[6]宋万杰,罗丰,吴顺君.CPLD技术及其应用.西安:

西安电子科技大学出版社,1999 

[7]张昌凡,龙永红,彭涛.可编程逻辑器件及VHDL设计技术.广州:

华南工学院出版社,2001

 

东北石油大学课程设计成绩评价表

课程名称

EDA技术课程设计

题目名称

洗衣机控制器

学生姓名

学号

指导教师姓名

职称

序号

评价项目

指标

满分

评分

1

工作量、工作态度和出勤率

按期圆满的完成了规定的任务,难易程度和工作量符合教学要求,工作努力,遵守纪律,出勤率高,工作作风严谨,善于与他人合作。

20

2

课程设计质量

课程设计选题合理,计算过程简练准确,分析问题思路清晰,结构严谨,文理通顺,撰写规范,图表完备正确。

45

3

创新

工作中有创新意识,对前人工作有一些改进或有一定应用价值。

5

4

答辩

能正确回答指导教师所提出的问题。

30

总分

评语:

 

指导教师:

2014年3月10日

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1