基于MAXII系列CPLD的微波炉控制器芯片设计_第1页
基于MAXII系列CPLD的微波炉控制器芯片设计_第2页
基于MAXII系列CPLD的微波炉控制器芯片设计_第3页
基于MAXII系列CPLD的微波炉控制器芯片设计_第4页
基于MAXII系列CPLD的微波炉控制器芯片设计_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

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

文档简介

1、浙江科技学院嵌入式系统(eda技术)课程设计报告书课题名称:基于max ii系列cpld的微波炉控制器芯片设计院、系 : 自动化与电气工程学院 专业班级: 建筑电气智能化 目 录第一章 绪论1第二章 设计目的2第三章 设计要求33.1 微波炉的功能要求33.2设计步骤3第四章 设计思想44.1微波炉定时器的工作过程44.2根据系统的基本要求4第五章 设计内容55.1状态控制电路模块65.2数据装载电路模块85.3计时器模块95.4状态控制源程序115.5控制器仿真及分析20设计总结23感 言24参考文献25第1章 绪论随着人们生活水平的提高和信息化的发展,家用电器层出不穷,各种功能也越来越完善

2、,其中微波炉是现代家庭的必备产品已经成为人们日用生活中的必不可少的厨房电器,大大降低了家庭妇女的工作量和工作强度,它的质量和性能的高低,将会极大的影响人们的生活水平和质量。为此,设计一个高质量的微波炉控制系统是非常有必要的。微波炉开始进入越来越多的家庭,他给人们的生活带来了极大的方便。微波炉由2450mhz的超高频来加热食物。他省时、省电、方便和卫生,作为现代的烹饪工具,微波炉的控制器体现着他的重要性能指标。目前大部分微波炉控制器采用单片机进行设计,带南路比较复杂性能不够灵活。本文采用先进的eda技术,利用quartusii工作平台和vhdl设计语言,设计了一种新型的微波炉控制器芯片,该芯片具

3、有系统复位、时间设定和烹饪计时的功能,用一片fpga芯片实现,所以能设计出一款方便安全操作的微波炉是非常有必要的。第2章 设计目的该设计用语言在软件平台上通过编译、模拟、仿真,完成了微波炉控制功能,实现了微波炉的测试、时间设置、烹调计时、完成提示等设计,并对时钟分频作了一定的探讨。此设计采用了现场可编程逻辑器件的 设计,由控制模块、装载模块、计时模块和显示模块四大模块组成,而且它可以将所有器件集成在一块芯片上,体积大大减小,且外围电路很简单,易于实现。第3章 设计要求3.1 微波炉的功能要求要求设计一个基于maxii系列的可调式数字闹钟,器件型号为epm240t100c5,功能要求如下:1、上

4、电后,系统自动复位:数码管显示全零,功率选择小火档,显示“1”,三挡加热输出均为低电平; 2、可以进行烹调时间的分、秒设置,并使用数码管显示时间信息,设要求最长的烹调时间为59分59秒;3、可以选择加热功率,分三档:高火、中火、小火,分别显示“3”,“2”,“1”;4、按“开始”按键进入烹调状态,根据功率选择输出加热控制信号,时间显示数码管按每秒减1的倒计时方式显示剩余烹调时间;5、烹调定时结束后,输出通知信号,系统回到复位状态。3.2设计步骤采用vhdl的系统设计,一般有以下6个步骤:(1)要求的功能模块划分; (2)vhdl的设计描述(设计输入); (3)代码仿真模拟(前仿真); (4)计

5、综合、优化和布局布线; (5)布局布线后的仿真模拟(后仿真); (6)设计的实现(下载到目标器件)。 第4章 设计思想4.1微波炉定时器的工作过程 上电后,系统处于复位状态。工作时首先进行烹调时间设置,并使用数码管显示时间信息,设要求最长的烹调时间为59分59秒,时间设置完毕后系统自动回到初始状态;按开始烹调按键进入烹调状态,时间显示数码管按每秒减1的倒计时方式显示剩余烹调时间;烹调结束后,系统回到复位状态。 4.2根据系统的基本要求 (1) 计时电路的设计:芯片内部产生和外部提供。本例中由外部时钟电路以bcd码的形式提供。 (2) 时间设置出错及工作过程的取消等情况的处理:设置一个复位按键。

6、 (3)数码管状态的检测:设置数码管检测按键,按动该按键后,数码管能够显示“8888”的信息。 (4) 时间显示电路:采用4位7段显示数码管显示,并由芯片直接驱动。 (5) 微波管的驱动:设置一个输出驱动控制烹调状态的继电器即可。第5章 设计内容微波炉控制器的功能设计要求,本系统可由一下4个模块组成:状态控制器kzq;数据装载器zzq;烹调计时器jsq;显示译码器ymq47;状态控制电路,其功能是控制微波炉工作过程中的状态转换,并发出相关控制信号;数据装载电路,其功能是根据控制信号选择定时时间,测试数据或计时完成信息的载入;计时器电路,其功能是对时钟进行减法计数,提供烹调完成时的状态信号。译码

7、器,就是负责将各种显示信息的bcd转换成七段数码管显示的驱动信息编码。微波炉控制器的系统框图如图1所示。其中,clk为时钟输入信号,时钟上升沿敏感;reset为复位信号,高电平有效时系统复位清零;test为数码显示管测试信号,高电平有效系统显示8888;set_t高电平有效时允许设置烹饪时间;key为定时时间输入信号,用于设置烹饪时间的长短,其高到低分别表示时间分、秒的十位、个位;start为烹调开始信号,高电平有效时开始烹调;输出信号cook指示微波炉状态,高电平时表示烹调进行时;sec0 、sec1、min0、min1分别表示秒个位、秒十位、分个位、分十位。图1 微波炉控制器的系统框图接通

8、电源初始状态时间设置显示8888烹调完成set_ttest?start?时间到?nynynyny图2 工作流程图首先,对系统进行复位清零,使其各电路模块均处于初始状态;当烹饪时间设置信号set_t有效时,读入时间信号key3.0的取值,此时系统显示设置的时间信息,再按下set_t确定设置时间完成。按下开始键start,系统进入烹调状态,cook信号变为高电平,时钟计数器开始减法计数,min1、min0、sec1、sec0显示剩余烹调时间。烹调结束,系统恢复初始状态。当系统处于复位清零状态时,按下显像管测试按钮test,将对显像管是否正常工作进行测试,正常工作时,显像管输出全8。5.1状态控制电

9、路模块状态控制器的功能根据输入信号和自身当时所处的状态完成状态的转换和输出相应的控制信号,其模块框图如图3所示。其中,输出信号ld_done指示数据装载电路载入的烹调结束的状态信息的显示的驱动信息数据;ld_clk显示数据装载电路的设置的时间数据;ld_test指示数据装载电路载入的用于测试的数据,以显示驱动信息数据;cook指示烹饪的状态,并提示计时器进行减法计算;key为定时时间输入信号,用于设置烹饪时间的长短,其高到低分别表示时间分、秒的十位、个位。当ld_done有效时,输出烹调结束数据。当ld_clk有效时,输出烹调的设置时间数据。当ld_test有效时,输出数码管测试数据包括6个输

10、入信号和4个输出信号。图3 状态控制电路模块框图根据微波炉工作流程的描述,分析状态转换条件及输出信号,可以得到如图4所示的微波炉控制器的状态转换图。test/ld_testreset初 始状 态idleset_clocklamp_testdone_msgtimerstart&done&test&set_t/cookld_done/cookx/ld_donex/ld_clkset_t&test/ld_clkx/ld_testdone/ld_done图4 状态控制器状态转换图减法计数定时状态t完成信息显示状态t烹调时间设置状态t显示译码测试状态t 图中,当reset信号有效时,系统复位清零;输入/

11、输出对应烹调时间设置、显示译码测试、完成信号显示和减法计数定时四种状态进行相应的转换。 5.2数据装载电路模块数据装载电路的本质是一个三选一多路选择器,其模块框图如图5所示。图5 数据装载电路模块框图当ld_done有效时,输出烹调结束的信息数据数据。当l_clk有效时,输出烹调的设置时间数据。当l_test有效时,输出数码管测试数据。load信号为ld_done时dateout输出key有效指示。5.3计时器模块 电路计时模块可以由十进制减法计数器和六进制减法计数器级联组成,其中,两个十进制的减法计数器用于分、秒的个位减法计数,两个六进制的减法计数器用于分、秒的十位减法计数。由六进制计数器和

12、十进制计数器级联构成的计时模块原理图如图6所示。图6 计时器模块原理图计时器模块的框图如图7所示。图7 计时器模块框图load有效时完成装入功能,cook(en)有效时执行减计数;clr由reset发出信号,清除装载已存的数据;done返回给控制器,min和sec显示所剩时间和测试状态信息、烹调结束状态信息等。显示译码控制部分的设计显示的数字或字母bcd编码七段显示驱动编码(ga)000000111111100010000110200101011011300111001111401001100110501011101101601101111101701110000111810001111111

13、910011101111d10101011110o10111011100n11001010100e11011111001设计内容状态控制符号图5.4状态控制源程序-状态控制电路的vhdl实现如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity controllor is port( reset:in std_logic; -复位信号 key: in std_logic_vector(3 downto 0);-输入时间 set_

14、t:in std_logic;-时间设置信号 start:in std_logic;-开始烹调信号 test:in std_logic;-显示电路测试信号 clk:in std_logic; -时钟脉冲 done:in std_logic;-完成信号 cook:out std_logic;-指示烹调状态,提示计时器开始计数 ld_test:out std_logic;-指示数据装载电路载入的用于测试的数据 ld_clk:out std_logic; -指示数据装载电路载入设置时间数据 data:out std_logic_vector(15 downto 0);-16位数据 led_set_t

15、:out std_logic; -led显示状态 ld_done:out std_logic -led显示完成 );end controllor;architecture rtl of controllor istype states is(idle,lamp_test,set_clock,timer,done_msg);signal nxt,cur:states; -2个信号:下一状态、当前状态signal datatmp:std_logic_vector(15 downto 0); signal set_t0: std_logic; -设置时间信号begin process(clk,res

16、et) -时钟和复位的进程 begin if reset=1 then -复位时将idle(显示0000)赋予当前状态 cur=idle; elsif clkevent and clk=1 then cur=nxt; -如果不是,遇到上边沿则自动跳转下一状态 end if;end process; process(reset,key) -复位和输入的进程 begin -可以让输入4位数字 显示时间 if reset = 1 then -复位时不论任何状态数码管都将显示0000 datatmp 0); else if key(3)event and key(3) = 1 then -设置分的十位

17、 if datatmp(15 downto 12) = 0101 then -5自动跳转到0 datatmp(15 downto 12) = 0000; else datatmp(15 downto 12) = datatmp(15 downto 12) + 1; end if; -否则自动加1 end if; if key(2)event and key(2) = 1 then -设置分的个位 if datatmp(11 downto 8) = 1001 then -9自动跳转到0 datatmp(11 downto 8) = 0000; else datatmp(11 downto 8)

18、= datatmp(11 downto 8) + 1; end if; -否则自动加1 end if; if key(1)event and key(1) = 1 then -设置秒的十位 if datatmp(7 downto 4) = 0101 then -5自动跳转到0 datatmp(7 downto 4) = 0000; else datatmp(7 downto 4) = datatmp(7 downto 4) + 1; end if; -否则自动加1 end if; if key(0)event and key(0) = 1 then -设置秒的个位 if datatmp(3 d

19、ownto 0) = 1001 then -9自动跳转到0 datatmp(3 downto 0) = 0000; else datatmp(3 downto 0) = datatmp(3 downto 0) + 1; end if; end if; -否则自动加1 end if; data = datatmp; end process; process(set_t,reset) -设置时间和复位进程 begin if reset = 1 then -复位时设置时间变为低电平 set_t0 = 0; elsif set_tevent and set_t = 1 then -按下set_t键时

20、set_t0 = not set_t0; -set_t非它前之状态 end if; if set_t0 = 1 then led_set_t = 1; -赋予set_t持续电平 else led_set_t = 0; -赋予set_t持续电平 end if; end process;process(clk,cur,set_t,start,test,done) isbegin nxt=idle; -将idle载入nxt ld_test=0; -复位 ld_done=0; ld_clk=0; cook -译码器显示测试状态 ld_test=1; cook -烹调时间测试状态 ld_clk=1; c

21、ook -完成信息显示状态 ld_done=0; cook -初始状态定义 if test=1 then nxt=lamp_test; -设置test ld_test=1; elsif set_t0=1 then -设置 set_t nxt=set_clock; ld_clk=1; elsif start=1 and done=0 then -设置计时模式 nxt=timer; cook if done=1 then -设置计时完成 nxt=done_msg; ld_done=0; else nxt=timer; cooknull; end case; end process;end rtl;

22、数据装载的符号图数据装载的源程序-数据装载电路的vhdl实现如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity loader is port( datain:in std_logic_vector(15 downto 0); -输入16位数据 ld_test:in std_logic; ld_clk:in std_logic; ld_done:in std_logic; dataout:out std_logic_vector(15 downto 0); -输出16位数据 load:ou

23、t std_logic -选择状态 );end loader;architecture rtl of loader isbegin process(datain,ld_test,ld_clk,ld_done) constant alls:std_logic_vector(15 downto 0)-测试信息 :=1000100010001000; -显示8888 constant done:std_logic_vector(15 downto 0)-烹调完成信息 :=1010101111001101; variable temp:std_logic_vector(2 downto 0); beg

24、in load-测试 dataout-烹调完成 dataout dataoutnull; end case; end process;end rtl;计时器电路的符号图计时器电路的源程序-十进制计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt10 is port( clk:in std_logic; load,clr:in std_logic; -clr:清除数据 en:in std_logic; -信号使能 datain:in std_logic_vector(3 do

25、wnto 0); -输入的4位数据 q:out std_logic_vector(3 downto 0); -输出的4位数据 carry_out:out std_logic -数据装载 );end cnt10;architecture rtl of cnt10 is signal tmp:std_logic_vector(3 downto 0); -链接输入输出begin -数据的信号 process(clk,load,clr,en) begin if clr = 1 then -当clr高电平,数据变为0000 tmp= 0000; elsif load=1then -否则装载输入的数据 t

26、mp=datain; elsif clkevent and clk=0then -上升沿时,执行10进制减法 if en=1then if tmp=0000then -0跳转到9 tmp=1001; else -自动减1 tmp=tmp-1; end if; end if; end if; if tmp=0000then carry_out=1; -cook=carry_out else carry_out=0; end if; end process; q=tmp;end rtl;-六进制减法计数器library ieee;use ieee.std_logic_1164.all;use ie

27、ee.std_logic_unsigned.all;entity cnt6 is port( clk:in std_logic; load,clr:in std_logic; en:in std_logic; datain:in std_logic_vector(3 downto 0); q:out std_logic_vector(3 downto 0); carry_out:out std_logic );end cnt6;architecture rtl of cnt6 issignal tmp:std_logic_vector(3 downto 0);begin process(clk

28、,load,clr,en) begin if clr = 1 then tmp= 0000; elsif load=1 then tmp=datain; elsif clkevent and clk=0then -上升沿时进行6进制减法 if en=1then if tmp=0000then -0自动跳转到5 tmp=0101; else tmp=tmp-1; -否则自动减1 end if; end if; end if; if tmp=0000then carry_out=1; -赋值给cook else carry_out=0; end if; end process; q=tmp;end

29、 rtl;-计时电路的vhdl实现如下:-计数器电路模块设计library ieee;use ieee.std_logic_1164.all;entity counter is port( cook:in std_logic; load,clr:in std_logic; clk:in std_logic; data:in std_logic_vector(15 downto 0); sec0:out std_logic_vector(3 downto 0); -秒个位 sec1:out std_logic_vector(3 downto 0); -秒十位 min0:out std_logic

30、_vector(3 downto 0); -分个位 min1:out std_logic_vector(3 downto 0); -分十位 done:out std_logic -完成 );end counter;architecture rtl of counter is-定义十进制和六进制计数器电路模块component cnt10 is port( clk:in std_logic; load,clr:in std_logic; en:in std_logic; datain:in std_logic_vector(3 downto 0); -输入 q:out std_logic_vec

31、tor(3 downto 0); -输出 carry_out:out std_logic -状态 );end component cnt10;component cnt6 is port( clk:in std_logic; load,clr:in std_logic; en:in std_logic; datain:in std_logic_vector(3 downto 0); q:out std_logic_vector(3 downto 0); carry_out:out std_logic );end component cnt6;signal clk0:std_logic;sign

32、al s0:std_logic;signal s1:std_logic;signal s2:std_logic;signal s3:std_logic;begin -元件例化 clk0 = not clk; u1:cnt10 port map(clk0,load,clr,cook,data(3 downto 0),sec0,s0); u2:cnt6 port map(s0,load,clr,cook,data(7 downto 4),sec1,s1); u3:cnt10 port map(s1,load,clr,cook,data(11 downto 8),min0,s2); u4:cnt6 port map(s2,load,clr,cook,data(15 downto 12),min1,s

温馨提示

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

最新文档

评论

0/150

提交评论