资源预览内容
第1页 / 共15页
第2页 / 共15页
第3页 / 共15页
第4页 / 共15页
第5页 / 共15页
第6页 / 共15页
第7页 / 共15页
第8页 / 共15页
第9页 / 共15页
第10页 / 共15页
亲,该文档总共15页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
课 程 设 计课程设计名称: 洗衣机控制器设计 专 业 班 级 : 姓名、学号 : 指 导 教 师 : 课程设计时间: 设计任务及要求利用可编程逻辑器件丰富的内部资源,借助EDA(电子设计自动化)工具把家电控制器电路集成在一片FPGA(现场可编程门阵列)芯片内,这样就无需专门的单片机和外部逻辑电路。从而减小了电路的体积、提高了系统的稳定性。本次电路设计是洗衣机控制器设计。设计的主要内容是:(1)设计一个洗衣机控制器,使洗衣机作如下运转:定时启动正转20秒暂停10秒反转20秒暂停10秒定时不到,重复上面过程。(2)若定时到,则停止,并发出音响信号。(3)用两个数码管显示洗涤的预置时间(分钟数),按倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由开始信号开始。(4)三只LED灯表示正转、反转、暂停三个状态。设计的主要要求是:(1)根据设计题目要求编写相应程序代码(2)对编写的VHDL程序代码进行编译和仿真(3)利用实验箱完成硬件验证(4)总结设计内容,完成课程设计说明书设计原理及总体框图洗衣机控制器的设计主要是定时器的设计,由一片FPGA和外围电路构成了电器控制部分。FPGA接收键盘的控制命令,控制洗衣机的进水、排水、水位和洗衣机的工作状态、并控制显示工作状态以及设定直流电机速度、正反转控制、制动控制、起停控制和运动状态控制。对FPGA芯片的编程采用模块化的VHDL (硬件描述语言)进行设计,设计分为三层实现,顶层实现整个芯片的功能。顶层和中间层多数是由VHDL的元件例化语句实现。中间层由无刷直流电机控制、运行模式选择、洗涤模式选择、定时器、显示控制、键盘扫描、水位控制以及对直流电机控制板进行速度设定、正反转控制、启停控制等模块组成,它们分别调用底层模块。停止(或转入下一个程序)定时启动正转暂停反转暂停 定时到 定时未到图1,流程图洗衣机控制器电路主要有五大部分组成,包括:减法计数器、时序控制电路、预置时间和编码电路、数码管显示、译码器组成。具体电路如图2所示:图2,洗衣机控制器总体设计图程序设计数码管显示 实现数码管显示library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity showtime is port(remain_time:in std_logic_vector(7 downto 0); cp:in std_logic; q1,q2:out std_logic;-q1为低位 a,b,c,d,e,f,g:out std_logic -数码管段码);end showtime;architecture rtl of showtime issignal temp:std_logic_vector(6 downto 0);signal bcd:std_logic_vector(3 downto 0);signal choose:std_logic;beginprocess(cp)begin if(cpevent and cp=1) then choose=not choose; if(choose=1) then q1=0;q2=1; bcd=remain_time(7 downto 4);-倒计时数码管十位(分钟) else q1=1;q2=0; bcd temp temp temp temp temp temp temp temp temp temptemp=1111011; end case;a=temp(6);b=temp(5);c=temp(4);d=temp(3);e=temp(2);f=temp(1);g temp; 0000= 1111110 ; 0001= 0110000 ; 0010= 1101101 ; 0011= 1111001 ; 0100= 0110011 ; 0101= 1011011 ; 0110= 1011111 ; 0111= 1110000 ; 1000= 1111111 ; 1001= 1111011 ; end table;a=temp(6);b=temp(5);c=temp(4);d=temp(3);e=temp(2);f=temp(1);g=temp(0);end rtl;时序电路控制洗衣机按20秒正转,停十秒。20秒反转,停十秒的顺序运行,直到时间结束信号的到来library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity shixu is port(cp,en,rd:in std_logic; q1,q2:out std_logic-00为停机,10为正转,01为反转);end shixu;architecture rtl of shixu isbegin process(cp)variable wash_time:integer range 0 to 19;variable wait_time:integer range 0 to 9;variable state:std_logic; -0代表正转,1代表反转variable wash_time:integer := 21;variable wait_time:integer := 9; begin if(en=0) wash_time:=19; wait_time:=9; state:=0; end if;if(en=0)then wash_time:=21; Q1=0;Q20) then wash_time:=wash_time-1; wait_time:=9;-等待时间恢复 else if(wait_time0)-运行时间结束,等待时间未到 then wait_time:=wait_time-1; -等待时间减1 else wash_time:=20; -等待时间结束,继续运行 state:=not state; end if; end if; - end if; 将译码也加入同步时序,可以减少毛刺 if(wash_time=0) then Q1=0;Q2=0;-暂停 else if(state=0)-正转 then Q1=1;Q2=0; else Q1=0;Q2=1;-反转 end if; end if; else Q1=0;Q2=0;-暂停 end if; end if;end if; end process;end rtl;预置时间和编码电路-预置时间与编码寄存电路,将输入的1-10分钟编为2个4位的BCD码library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity settime is port(load:in std_logic; k:in std_logic_vector(9 downto 0); o:out std_logic_vector(7 downto 0);end settime;architecture rtl of settime is signal p1:std_logic_vector(7 downto 0);begin process(lo
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号