EDA时钟设计动态LED显示.doc_第1页
EDA时钟设计动态LED显示.doc_第2页
EDA时钟设计动态LED显示.doc_第3页
EDA时钟设计动态LED显示.doc_第4页
EDA时钟设计动态LED显示.doc_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

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

文档简介

课程设计计时器设计31, 设计目的 :32, 设计要求:33, 设计原理:41, 数字钟的基本工作原理:42, 自顶向下设计分割图:44, 计数显示电路55, 设计思路51,时钟计数:52,清零功能:56, 仿真51, 秒计时模块5秒计时器仿真波形:72, 分计时模块7仿真波形93,十计时模块9仿真波形104, 16分频模块10仿真波形115, LED显示模块126,Settime仿真13原理图159, 设计总结16 计时器设计1, 设计目的 :1、地运用数字系统的设计方法进行数字系统设计。2、能进行较复杂的数字系统设计。 3、数字钟的工作原理, 数字钟的工作流程图与原理方框图, 自顶向下的数字系统设计方法。2, 设计要求:功能:实现时、分、秒的计时输入信号:时钟信号clk为16kHz输出信号:七位LED数码管(共阴极)显示码(静态显示方式)要求:系统由分频器(将16kHz时钟变为1Hz)、60进制计数器(秒和分的计数)、24进制计数器(时的计数)和显示码译码器(将时间的BCD码转换成LED显示码)组成。要求给出系统总体组成框图,设计思路,完成以上模块的VHDL实现及功能仿真,顶层文件及整体仿真3, 设计原理:1, 数字钟的基本工作原理: 数字钟以其显示时间的直观性、走时准确性而受到了人们的欢迎并很快走进了千家万户。作为一种计时工具,数字钟的基本组成部分离不开计数器,在控制逻辑电路的控制下完成预定的各项功能。数字钟的基本原理方框图如下:调时、调分控制电路位选信号发生电路控制逻辑电路计数器 电路时基T产生电路1Hz晶振分频整形门控双稳脉冲计数译码显示 图1-1时钟基本框图它由振荡器、分频器、计数器、译码器显示器和校时电路组成。振荡器产生稳定的高频脉冲信号,作为数字钟的时间基准,然后经过分频器输出标准秒脉冲。秒计数器满60后向分计数器进位,分计数器满60后向小时计数器进位,小时计数器按照“24翻1”规律计数。计数器的输出分别经译码器送显示器显示、 2, 自顶向下设计分割图: 数 字 钟计数显示电路控制逻辑电路2选1数据选择器位选信号发生器计数器译码器数据选择器 图1-2设计层次图4, 计数显示电路由计数部分、数据选择器、译码器组成,是时钟的关键部分。1、计数部分:由两个60进制计数器和一个24 进制计数器组成,2、数据选择器:84 输入14 输出的多路数据选择器,因为本实验用到了6个数码管。3、译码器:由于设计要求是用六个LED显示,共阴极接法,所以当需要显示0、1、2、3、4、5、6、7、8、9时对应的LED显示码是3F、06、5B、4F、66、6D、7D、07、7F.采用静态输出方法输出。5, 设计思路根据系统设计要求,系统设计采用自顶向下设计方法,由时钟分频部分、计时部分、按键部分调时部分和显示部分五个部分组成。这些模块都放在一个顶层文件中。1,时钟计数:首先下载程序进行复位清零操作,电子钟从00:00:00计时开始。由于电子钟的最小计时单位是1s,因此提供给系统的内部的时钟频率应该大于1kHz,这里取16kHz。对clk进行计数,当clk=10时,秒加1,当秒加到60时,分加1;当分加到60时,时加1;当时加到24时,全部清0,从新计时。用6位数码管分别显示“时”、“分”、“秒”,通过SEG_DA 上的信号来点亮指定的LED六段显示数码管。2,清零功能:RST为复位键,低电平时实现清零功能,高电平时正常计数6, 仿真1, 秒计时模块LIBRARY ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY second ISPORT(clk,reset,setmin:IN STD_LOGIC;enmin:OUT STD_LOGIC;daout:out std_logic_vector(6 downto 0);END entity second;ARCHITECTURE fun OF second ISSIGNAL count:STD_LOGIC_VECTOR(6 downto 0);SIGNAL enmin_1,enmin_2:STD_LOGIC;BEGINdaout=count;enmin_2=(setmin and clk);enmin=(enmin_1 or enmin_2);process(clk,reset,setmin)beginif(reset=0) then count=0000000;elsif(clkevent and clk=1)thenif(count(3 downto 0)=1001)thenif(count16#60#)thenif(count=1011001)thenenmin_1=1;count=0000000;elsecount=count+7;end if;elsecount=0000000;end if;elsif(count16#60#)thencount=count+1;enmin_1=0 after 100 ns;elseend if;end if;end process;end fun ;秒计时器仿真波形: 图6-1 秒计时器仿真波形2, 分计时模块library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity fen is port(clk,reset:in std_logic; enhour:out std_logic; daout:out std_logic_vector(6 downto 0); end entity fen; architecture art of fen is signal count:std_logic_vector(6 downto 0); begin daout=count; process(clk,reset) begin if(reset=0)then count=0000000; enhour=0; elsif(clkevent and clk=1)then if(count(3 downto 0)=1001)then if(count16#60#)thenif(count=1011001)then enhour=1;count=0000000; else count=count+7; enhour=0; end if; else count=0000000; end if; elsif(count16#60#)then count=count+1; enhour=0 after 100 ns; else count=0000000;enhour=0; end if; end if; end process; end art;仿真波形 图6-2 分计时器仿真波形3,十计时模块library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity shi is port(clk,reset:in std_logic; daout:out std_logic_vector(5 downto 0); end shi ; architecture rtl of shi is signal count:std_logic_vector(5 downto 0); begin daout=count; process(clk,reset) begin if(reset=0)then count=000000; elsif(clkevent and clk=1)then if(count(3 downto 0)=1001)then if(count16#23#)then count=count+7; else count=000000; end if; elsif(count16#23#)then count=count+1; else count=000000; end if; end if; end process; end rtl; 仿真波形 图6-3 时计时器仿真波形4, 16分频模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenp isport( rst: in std_logic;clk: in std_logic;fpclk: out std_logic);end fenp;architecture arc of fenp isbeginprocess(clk)variable count: integer range 0 to 16;variable clk0: std_logic;beginif rst=0 then clk0:=0 ;elsif clkevent and clk=1 thenif count=16 thenclk0:=not clk0; count:=0; else count:=count+1;end if;end if; Fpclk=clk0;end process;end arc;仿真波形 图6-4 16分频器仿真波形5, LED显示模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity LED isport(num:in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0);end LED;architecture art of LED isled=1111110when num=0000else0110000when num=0001else1101101when num=0010else1111001when num=0011else0110011when num=0100else1011011when num=0101else1011111when num=0110else1110000when num=0111else1111111when num=1000else1111011when num=1001else1110111when num=1010else0011111when num=1011else1001110when num=1100else0111101when num=1101else1001111when num=1110else1000111when num=1111;End; 图6-5 led仿真波形6,Settime仿真Library ieee;Use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;Entity settime isport(clk1,reset:in std_logic;sec,min:in std_logic_vector(6 downto 0);hour:in std_logic_vector(5 downto 0);daout:out std_logic_vector(3 downto 0);End settime;Architecture art of settime isSignal count:std_logic_vector(2 downto 0);beginprocess(clk1,reset)beginif(reset=0)then count=101)then count=000;Else count=count+1;End if;End if;end process;process(clk1,reset)beginif(reset=0)then daoutdaoutdaout(3)=0;daout(2 downto 0)daoutdaout(3)=0;daout(2 downto 0)daoutdaout(3 downto 2)=00;daout(1 downto 0)daoutclk0,fpclk=h);U2:second port map(clk=h,reset=rst,enmin=a,daout=c,daout(7 downto 4)=a1,daout(3 downto 0)=a2);U3:fen por

温馨提示

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

评论

0/150

提交评论