版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、数电实验报告题 目 基于FPGA的洗衣机控制系统的实现 时 间 2011年6月27日 摘要 本试验基于FPGA设计了简单的洗衣机控制系统,该系统能实现包括定时,洗衣等功能。本试验主要利用VHDL语言写出相关的程序,然后通过仿真软件modelsim进行模拟仿真。关键词洗衣机 控制系统 FPGA目录第一章 实验任务与原理 2第二章 FPGA模块程序设计与仿真 2附录 22第一章 实验任务与原理1、 功能需求(1)设计一个洗衣机控制器,使洗衣机作如下运转:定时启动正转20秒暂停10秒反转20秒暂停10秒定时不到,重复上面过程;(2)若定时到,则停止;(3)用两个数码管显示洗涤的预置时间(分钟数),按
2、倒计时方式对洗涤过程作计时显示,直到时间到停机;洗涤过程由开始信号开始;(4)三只LED灯表示正转、反转、暂停三个状态。2、原理阐述洗衣机控制器的设计主要是定时器的设计,由一片FPGA和外围电路构成了电器控制部分。FPGA接收键盘的控制命令,控制洗衣机的进水、排水、水位和洗衣机的工作状态、并控制显示工作状态以及设定直流电机速度、正反转控制、制动控制、起停控制和运动状态控制。对FPGA芯片的编程采用模块化的VHDL (硬件描述语言)进行设计。定时启动正转反转暂停暂停停止定时未到定时到 图一 洗涤过程第二章 FPGA模块程序设计与仿真洗衣机控制器电路主要有五大部分组成,包括:减法计数器、时序控制电
3、路、预置时间和编码电路、数码管显示、译码器组成。 图二 洗衣机控制器电路说明图1、预置时间和编码电路(1)、模块源程序 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- Uncomment the following library declaration if instantiating- any Xilinx primitives in this code.-library UNISIM;-use UNISIM.VComponents
4、.all;entity test_2 is port(clk:in std_logic; reset:in std_logic;set:in std_logic; load:in std_logic_vector(9 downto 0);en_out:out std_logic_vector(3 downto 2);dout_p:out std_logic_vector(7 downto 0);end test_2;architecture Behavioral of test_2 is signal p1:std_logic_vector(7 downto 0);beginprocess(c
5、lk,load,reset,set) begin if(reset=1) then p1p1p1p1p1p1p1p1p1p1p1p1=; end case; if(p1=) then en_out(3)=1; en_out(2)=0; dout_p=; else en_out(3)=0; en_out(2)dout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_p 0); -Outputs signal en_out : std_logic_vector(3 downto 2); signal dout_p : std_logic_
6、vector(7 downto 0); - Clock period definitions constant clk_period : time := 10 ns; BEGIN - Instantiate the Unit Under Test (UUT) uut: test_2 PORT MAP ( clk = clk, reset = reset, set = set, load = load, en_out = en_out, dout_p = dout_p ); - Clock process definitions clk_process :process beginclk = 0
7、;wait for clk_period/2;clk = 1;wait for clk_period/2; end process; - Stimulus process stim_proc: process begin - hold reset state for 100 ns. reset=1;set=0;wait for 50 ns; reset=0; set=1; load=; wait; end process;END;(3)、模拟结果图 2、定时器模块(1)、模块源程序 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use ieee.std_lo
8、gic_arith.all;use ieee.std_logic_unsigned.all;entity test_1 is port(clk:in std_logic; reset:in std_logic;start:in std_logic;p1:in std_logic_vector(7 downto 0);time_is_up_out:out std_logic;count_out:out std_logic_vector(19 downto 0);en_out:out std_logic_vector(1 downto 0);dout_p:out std_logic_vector(
9、7 downto 0);end test_1;architecture Behavioral of test_1 is signal time_remain: std_logic_vector(7 downto 0);signal time_is_up:std_logic;signal count:std_logic_vector(19 downto 0);beginprocess(clk,reset,start,p1) -variable time_temp:int; begin if(reset=1) then time_remain=p1;time_is_up=0;count=; els
10、if(clkevent and clk=1) then if(start=1 and time_is_up=0) then if(time_remain=) then time_is_up=1; else if(count=) then count=; time_remain=time_remain-1; else count=count+1; end if;end if;count_out=count;time_is_up_out=time_is_up; if(time_remain=) then en_out(1)=1; en_out(0)=0; dout_p=; else en_out(
11、1)=0; en_out(0)dout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_pdout_p=; end case; end if;end if;end if;time_is_up_out 0); -Outputs signal time_is_up_out : std_logic; signal count_out : std_logic_vector(19 downto 0); signal en_out : std_logic_vector(1 downto 0); signal dout_p : std_logic_vector
12、(7 downto 0); - Clock period definitions constant clk_period : time := 10 ns;BEGIN- Instantiate the Unit Under Test (UUT) uut: test_1 PORT MAP ( clk = clk, reset = reset, start = start, p1 = p1, time_is_up_out = time_is_up_out, count_out = count_out, en_out = en_out, dout_p = dout_p ); - Clock proce
13、ss definitions clk_process :process beginclk = 0;wait for clk_period/2;clk = 1;wait for clk_period/2; end process; - Stimulus process stim_proc: process begin - hold reset state for 100 ns. reset=1;start=0;p1=;wait for 10 ns; reset=0;start=1; wait; end process;END;(3)、仿真结果图3、洗衣控制模块(1)、模块源程序 library
14、IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- Uncomment the following library declaration if using- arithmetic functions with Signed or Unsigned values-use IEEE.NUMERIC_STD.ALL;entity test_3 is port(clk:in std_logic; reset
15、:in std_logic; start:in std_logic; time_is_up:in std_logic; rev,run,pause:out std_logic );end test_3;architecture Behavioral of test_3 is signal cnt:std_logic_vector(18 downto 0);signal q1,q2:std_logic;beginprocess(clk,reset,start,time_is_up)begin if(reset=1) then q1=0; q2=0; pause=0;cnt=; elsif(clk
16、event and clk=1)then if(start=1 and time_is_up=0) then if(cnt=) then cnt=; q1=1; q2=0; pause=0; elsif(cnt=) then q1=0;q2=0;pause=1; elsif(cnt=) then q1=0;q2=1;pause=0; elsif(cnt=) then q1=0;q2=0;pause=1; end if; cnt=cnt+1;end if;end if;run=q1; rev clk, reset = reset, start = start, time_is_up = time
17、_is_up, rev = rev, run = run, pause = pause ); - Clock process definitions clk_process :process beginclk = 0;wait for clk_period/2;clk = 1;wait for clk_period/2; end process; - Stimulus process stim_proc: process begin - hold reset state for 100 ns. reset=1;start=0;time_is_up=0;wait for 10 ns; reset
18、=0;start=1;time_is_up=0; wait; end process;END;(3)、仿真结果图附录:本试验的源程序library IEEE;use IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;- Uncomment the following library declaration if using- arithmetic functions with Signed or Unsigned values-use IEEE.NUMERIC_STD.ALL
19、;- Uncomment the following library declaration if instantiating- any Xilinx primitives in this code.-library UNISIM;-use UNISIM.VComponents.all;entity xiyi is port( clk:in std_logic;reset:in std_logic;start:in std_logic; set:in std_logic;load:in std_logic_vector(9 downto 0);en_out:out std_logic_vect
20、or(3 downto 0);time_is_up_out:out std_logic;rev:out std_logic;run:out std_logic;pause:out std_logic;dout_p_T,dout_p_s:out std_logic_vector(7 downto 0);time_left_out: out std_logic_vector(7 downto 0);count_out:out std_logic_vector(19 downto 0);p1_out:out std_logic_vector(7 downto 0);end xiyi;architec
21、ture Behavioral of xiyi is signal q1,q2:std_logic; signal time_is_up:std_logic; signal pause_z,pause_f:std_logic; signal p1:std_logic_vector(7 downto 0); signal time_left:std_logic_vector(7 downto 0); signal count:std_logic_vector(19 downto 0); signal cnt:std_logic_vector(18 downto 0);begin-定时器电路-pr
22、ocess(clk,reset,start,set) begin if(reset=1) thentime_is_up=0;count=; elsif(clkevent and clk=1 and set=0) then if(start=1 and time_is_up=0) then if(time_left=) then time_is_up=1; else if(count=) then count=; time_left=time_left-1; else count=count+1; end if;end if; if(time_left=) then en_out(1)=1; en_out(0)=0; dout_p_T=; else en_out(1)=0; en_out(0)dout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_Tdout_p_T=; end case; end if;end if;end if;time_is_up_out=time_is_up;time
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年铜陵市郊区事业单位统一公开招聘工作人员17名考试备考题库及答案解析
- 北京市大兴区城市管理指挥中心招聘劳务派遣1人考试备考试题及答案解析
- 2026年瑜伽教练课堂引导技巧
- 2026四川泸州市泸县审计局招聘工程人员参与审计项目12人笔试备考试题及答案解析
- 2026年安徽科技学院引进海内外高层次人才预笔试参考题库及答案解析
- 2026浙江省农业科学院招聘1人笔试模拟试题及答案解析
- 2026年钢材结构的实验与应用案例
- 2026上半年贵州事业单位联考黔西市招聘295人笔试参考题库及答案解析
- 2026湖南郴州北湖机场有限公司面向社会残疾人员招聘1人考试备考题库及答案解析
- 2026年黑金色的时光之旅
- 江苏省盐城市大丰区四校联考2025-2026学年七年级上学期12月月考历史试卷(含答案)
- 事业编退休报告申请书
- 原发性骨髓纤维化2026
- 半导体厂务项目工程管理 课件 项目6 净化室系统的设计与维护
- 河南省洛阳强基联盟2025-2026学年高二上学期1月月考英语试题含答案
- 2026年中考数学模拟试卷试题汇编-尺规作图
- 玻璃钢水箱安装详细技术方案
- 山东省烟台市开发区2024-2025学年上学期期末八年级数学检测题(含答案)
- 桂花香包制作课件
- 社会工作本科毕业论文
- (2025年)架子工考试模拟题(带答案)
评论
0/150
提交评论