EDA电风扇自动定时控制器的设计.docx_第1页
EDA电风扇自动定时控制器的设计.docx_第2页
EDA电风扇自动定时控制器的设计.docx_第3页
EDA电风扇自动定时控制器的设计.docx_第4页
EDA电风扇自动定时控制器的设计.docx_第5页
免费预览已结束,剩余13页可下载查看

下载本文档

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

文档简介

EDA技术课程设计任务书系(部):电子与通信工程系 专业:电气工程及其自动化 指导教师:课题名称电风扇自动定时控制器的设计设计内容及要求实现一个电风扇自动定时控制器,该控制器可设置电风扇延迟启动时间及风扇运转的时间(分、秒);使用数码管显示延迟启动或风扇运转的倒计时时间。如:C-02-55表示延迟状态剩余键位2分55秒;A-03-12表示风扇还要继续运行3分12秒;“开始”按钮按下时,报讯3声;“暂停”按钮按下时,停止倒计时,再按一次暂停键,倒计时开始。系统提供50MHZ频率的时钟源。完成该系统的硬件和软件的设计,并制作出实物装置,调试好后并能实际运用(指导教师提供制作所需的器件),最后就课程设计本身提交一篇课程设计说明书。设计工作量1、VHDL语言程序设计;2、波形仿真;3、在实验装置上进行硬件测试,并进行演示;4、提交一份完整的课程设计说明书,包括设计原理、程序设计、程序分析、仿真分析、硬件测试、调试过程,参考文献、设计总结等。进度安排起止日期(或时间量)设计内容(或预期目标)备注第1天课题介绍,答疑,收集材料第2天设计方案论证第3天进一步讨论方案, 对设计方案进行必要的修正,方案确定后开始进行VHDL语言程序设计第4天设计VHDL语言程序第59天在实验装置上进行硬件测试,对VHDL语言程序进行必要的修正,并进行演示第10天编写设计说明书教研室意见年 月 日系(部)主管领导意见年 月 日课程设计鉴定表姓名学号专业电气工程及其自动化班级设计题目电风扇自动定时控制器的设计指导教师指导教师意见:评定等级: 教师签名: 日期: 答辩小组意见:评定等级:答辩小组长签名:日期:教研室意见:教研室主任签名: 日期: 系(部)意见:系主任签名:日期:说明课程设计成绩分“优秀”、“良好”、“及格”、“不及格”四类;目录一、设计目的2二、设计环境2三、设计原理23.1 设计框图23.2 模块功能介绍23.3 引脚描述23.4 模块程序设计及其仿真结果23.4.1分频模块23.4.2倒计时模块23.4.3 模式控制模块23.4.4 蜂鸣器模块23.4.5 扫频模块23.4.6 顶层模块设计2四、硬件测试结果2五、心得体会2六、参考文献2一、设计目的(1)熟悉FPGA开发的环境和FPGA的结构,了解FPGA开发的流程,熟悉VHDL语言设计电路的方法;(2)能够更熟练地使用VHDL设计FPGA;(3)增加把知识用于实践的实践能力。二、设计环境软件环境:Quartus9.0设备:Create-SOPC实验平台 ByteBlaster下载电缆三、设计原理 3.1 设计框图stopout0bin 倒计时模块扫频模块分频模块clk模式控制模块qain蜂鸣器模块startyy总体设计可以分为以上几个模块3.2 模块功能介绍 (1)分频模块模块的功能是把 50MHz 的系统时钟转换为两个 1Hz 的时钟一个1/1000000Hz的时钟。1Hz的时钟供倒计数模块和蜂鸣器模块的使用;1/1000000Hz的时钟供扫频模块的使用。(2)倒计时模块 选择开始(暂停)模式后,通过控制使能端有效开始倒计时,表示电风扇开始工作倒计时(暂停倒计时)。(3)模式控制模式选择需要的工作模式。包括两个模式:暂停、开始。(4)蜂鸣器模块 倒计时开始前报讯三声。(5)扫频模块 能够正常显示工作模式和倒计时时间。3.3 引脚描述(1)输入开关管脚 表1.信号名称功能描述输入输出位宽引脚分配clk系统时钟,频率为50MHzinput1PIN_J3stop倒计时模块时能端,低电平有效input1PIN_M3bin倒计时模块置位端低电平正计数,高电平减计数input1PIN_M4start蜂鸣器模块、倒计时模块、模式选择模块的使能端,高电平有效Input1PIN_R1ain模式选择模块置位端,高电平为开始,低电平为暂停input1PIN_P3(2)输出显示管脚表2信号名称功能描述输入输出位宽引脚分配q控制ga的亮灭output7q6PIN_K4q5PIN_L2q4PIN_H1q3PIN_H4q2PIN_H3q1PIN_L4q0PIN_L3out0控制八个数码管的两灭output8out00PIN_G4out01PIN_G3out02PIN_E2out03PIN_F2out04PIN_F1out05PIN_G2out06PIN_G1out07PIN_H2yy接蜂鸣器,高电平有效output1PIN_F143.4 模块程序设计及其仿真结果3.4.1分频模块 (1)实验程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpin is port(clk0: in std_logic; y: out std_logic);end fenpin;architecture one of fenpin is signal full:std_logic; begin p_reg:process(clk0) -1 Hz分频 variable cnt:integer range 1 to 50000000; begin if clk0event and clk0=1 thenif cnt=25000000 thencnt:=1;full=1;else cnt:=cnt+1;full=0;end if;end if; end process p_reg; p_div:process(full) variable cnt2:std_logic; begin if fullevent and full=1 thencnt2:=not cnt2;if cnt2=1 theny=1;elsey=0;end if;end if; end process p_div;end one;这个程序是将50MHz变成1Hz,若要得到1/1000000Hz则适当做些改变。(2)引脚描述 信号名称功能描述输入输出位宽Clk0输入50MHz的时钟信号input1y输出经过分频后的1Hz(1/1000000Hz)的时钟信号output1(3)仿真波形 3.4.2倒计时模块 (1)实验程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity aaa is port (cn,en1,en2,rst,carry:in std_logic; cout :out std_logic; flow,fhigh,mlow,mhigh:out std_logic_vector(3 downto 0);end aaa;architecture art of aaa issignal fdisplow,fdisphigh,mdisplow,mdisphigh:std_logic_vector(3 downto 0); -定义信号分别表示分钟和秒钟的十位和个位beginprocess(cn,carry,en1,en2,rst)beginif en1=0 then if en2=1 then if(rst=0)then mdisplow=0000; mdisphigh=0000; fdisplow=0000; fdisphigh=0000; cout=0; -rst低电平执行复位 elsif (carryevent and carry=1)then if cn=0then if mdisplow9 then mdisplow=mdisplow+1;-秒钟个位数小于9时执行计数加1 cout=0; elsif mdisplow=1001 and mdisphigh5 then mdisplow=0000; mdisphigh=mdisphigh+1;-秒钟十位进位加1 elsif mdisphigh=0101 and fdisplow9 then mdisplow=0000; mdisphigh=0000; fdisplow=fdisplow+1;-满59秒后分钟个位加1 elsif fdisplow=1001 and fdisphigh9 then mdisplow=0000; mdisphigh=0000; fdisplow=0000; fdisphigh=fdisphigh+1;-满9分59秒后分钟十位加1 elsif fdisplow=1000 and fdisphigh=1001 then mdisplow=0000; mdisphigh=0000; fdisplow=1001;-计时至99分停止 elsif fdisplow=1001 and fdisphigh=1001 then cout0 then mdisplow=mdisplow-1;-秒钟减1 cout0 then mdisplow=1001; mdisphigh0 then mdisplow=1001; mdisphigh=0101; fdisplow0 then mdisplow=1001; mdisphigh=0101; fdisplow=1001; fdisphigh=fdisphigh-1;-分减10 elsif fdisphigh=0000and fdisplow=0000and mdisphigh=0000and mdisplow=0000then cout=1;-倒计时结束cout变为高电平 end if; end if;end if;end if;end if;end process;mhigh=mdisphigh;mlow=mdisplow;fhigh=fdisphigh;flow=fdisplow;end art;(2)引脚描述信号名称功能描述输入输出位宽carry1Hz时钟信号输入input1rst复位端input1cn置位端input1en1使能端1,低电平有效input1en2使能端2,高电平有效input1fhigh分计数十位output4flow分计数个位output4mhigh秒计数十位Output4mlow秒计数个位output4(3)仿真波形3.4.3 模式控制模块(1)实验程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity st isport(en,a:in std_logic; -a-PIN_M3(FPGA_M1) led7s7,led7s6,led7s3,led7s8:out std_logic_vector(3 downto 0); end; architecture one of st is begin process(a) begin if en=1 then if a=1 then led7s7=1010; else led7s7=1100; end if; led7s6=1110; led7s3=1110; led7s8=1101; end if; end process; end;(2)引脚描述信号名称功能描述输入输出位宽a置位端Input1En使能端Input1Led7s7第七个数码管Output4Led7s3第三个数码管Output4Led7s6第六个数码管Output4Led7s8第八个数码管output4(3)仿真波形3.4.4 蜂鸣器模块(1)实验程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fengming isport(clk1:in std_logic; en:in std_logic; y:out std_logic);end;architecture one of fengming issignal y0:std_logic;begin process(clk1,en)variable md:std_logic_vector(5 downto 0);begin if clk1event and clk1=1 then if en=0 then md:=101010; else y0=md(5); md(5 downto 1):=md(4 downto 0); md(0):=0; end if; end if;ybt=00000001;abt=00000010;abt=00000100;abt=00001000;abt=00010000;abt=00100000;abt=01000000;abt=10000000;abt=00000000;end case ;end process p1;p2:process (clk8)variable ct:integer range 0 to 250;begin if clk8event and clk8=1 then if ct249 thenct:=ct+1;clk1=0;else ct:=0;clk1=1;end if;end if;end process p2;process(clk1)begin if clk1event and clk1=1 thenif cnt47 thencnt4=cnt4+1;else cnt4sgsgsgsgsgsgsgsgsgsgsgsgsgsgsgnull;end case ;end process;end;(2)引脚描述信号名称功能描述输入输出位宽Clk81/1000000Hz时钟信号输入Input1A1输入控制各个数码管显示Input4A2A3A4A5A6A7A8Sg接q输出Output7bt接bt输出output8(3)仿真波形3.4.6 顶层模块设计(1)顶层模块程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity dfs_auto isport(clk,ain,bin,start,stop:in std_logic; q:out std_logic_vector(6 downto 0); yy:out std_logic; out0:out std_logic_vector(7 downto 0); end;architecture one of dfs_auto iscomponent fenpinport(clk0: in std_logic; y: out std_logic); end component; component fenpin2port(clk0: in std_logic; y: out std_logic); end component; component fenpin3port(clk0: in std_logic; y: out std_logic); end component; component fengmingport(en:in std_logic; clk1:in std_logic; y:out std_logic); end component;component aaaport (cn,en1,en2,rst,carry:in std_logic; cout :out std_logic; flow,fhigh,mlow,mhigh:out std_logic_vector(3 downto 0); end component;component stport(en,a:in std_logic; led7s7,led7s6,led7s3,led7s8:out std_logic_vector(3 downto 0); end component;component scan port (clk8 :in std_logic; a1,a2,a3,a4,a5,a6,a7,a8:in std_logic_vector(3 downto 0); sg:out std_logic_vector(6 downto 0); bt: out std_logic_vector(7 downto 0);end component;signal m1,m6,m10:std_logic;signal m2,m3,m4,m5,m7,m8,m9,m11:std_logic_vector(3 downto 0);begin u1:fenpin port map(clk0=clk,y=m1); u2:fenpin2 port map(clk0=clk,y=m6); u3:aaa port map(carry=m1,rst=start,cn=bin,en1=stop,en2=start,fhigh=m2,flow=m3,mhigh=m4,mlow=m5); u4:fengming port map(clk1=m6,en=start,y=yy); u5:fenpin3 port map(clk0=clk,y=m10); u6:st port map(a=ain,en=start,led7s7=m7,led7s6=m8,led7s3=m9,led7s8=m11); u7:scan port map(clk8=m10,a5=m2,a4=m3,a2=m4,a1=m5,a3=m9,a6=m8,a7=m7,a8=m11,bt=out0,sg=q);end;(2)引脚描述见表1.、表2.(3)仿真波形四、硬件测试结果经过仿真测

温馨提示

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

最新文档

评论

0/150

提交评论