EDA数字时钟设计_第1页
EDA数字时钟设计_第2页
EDA数字时钟设计_第3页
EDA数字时钟设计_第4页
EDA数字时钟设计_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

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

文档简介

1、目录.设计实验目的.设计实验说明.设计实验要求.功能设计1时钟计数.时间设置.清零功能.整点报时功能.数字时钟计数报时VHDL程序设计仿真与分析.秒计数器(miao)VHDL程序描述、仿真波形图及其分析.分计数器(fen) VHDL程序描述、仿真波形图及其分析.时计数器(shi) VHDL程序描述、仿真波形图及其分析.整点报时器(baoshi)VHDL程序描述、仿真波形图及其 分析.分频器(fenpin)设计、仿真波形图及其分析.扫描显示译码器(saomiao) VHDL程序描述、仿真波形图 及其分析.数字时钟整体设计原理图及其分析.设计总结.参考文献1设计实验目的:熟练运用VHDL语言,完成

2、数字时钟设计的软件编程、编译、综合、仿真,使用EDA 实验箱,实现数字时钟的硬件功能。2设计实验说明:.数字时钟主要由:分频器、扫描显示译码器、六十进制计数器(或十进制计数器 与6进制计数器组成)、六十进制计数器(或十进制计数器与6进制计数器组成)、十二 进制计数器(或二十四进制计数器)电路组成。在整个时钟中最关键的是如何获得一个精 确的1HZ计时脉冲。.数字时钟显示由时(12或24进制任选)、分(60进制)、秒(60进制)组成, 利用扫描显示译码电路在六个数码管显示。.数字时钟组成及功能:数字时钟组成及功能:.分频率器:用来产生1HZ计时脉冲;2.十二或二十四进制计数器:对时进行计 数3.六

3、十进制计数器:对分和秒进行计数;4.六进制计数器:分别对秒十位和分十位进行 计数;5.十进制计数器:分别对秒个位和分个位进行计数;6.扫描显示译码器:完成对7. 字段数码管显示的控制;.设计实验要求:.精确显示时、分、秒。.数字时钟要求:具有对时、分、秒置数功能。.能够完成整点报时功能。.功能设计:.时钟计数:完成时、分、秒的正确计时并且显示所计的数字;对秒、分60进制计数, 即从0到59循环计数,对时24进制计数,即从0到23循环计数。.时间设置:手动调节分钟(setfen)、小时(setshi),高定平时有效,可以对分、时进 行进位调节,低电平时正常计数。这样可以对所设计的时钟的时间任意调

4、。.清零功能:reset为复位端,低电平时实现清零功能,高电平时正常计数。这样可以 对所设计的时钟的时间进行清零处理。.整点报时功能:当分由59进位时,会在整点报时输出端输出高电平,此信号可以通 过LED点亮检验。.数字时钟计数报时VHDL程序设计仿真与分析. (1)秒计数器(miao) VHDL程序描述library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity miao isport(clk,reset,setfen:in std_logic;enfen:out std_logic;count

5、miao:out std_logic_vector(7 downto 0);end miao;architecture fun of miao issignal count:std_logic_vector(7 downto 0);signal enfen_1,enfen_2:std_logic;begincountmiao=count;enfen_2=(setfen and clk);enfen=(enfen_1 or enfen_2);process(clk,reset,setfen)beginif(reset=0t)then count=00000000;enfen_1=0;elsiff

6、clkevent and clk=l1l)then if(count(3 downto 0)=1001”)then if(count16#60#)then if(count=01011001)then count=00000000;enfen_1=11;else count=count+7;end if;else count=00000000”;enfen_1=0;end if;elsif(count16#60#)then count=count+1;enfen_1=0;else count=00000000;enfen_1=1;end if;end if;end process;end fu

7、n;(2)秒计数器(miao)仿真波形图里 PMFf 3(3)秒计数器(miao)仿真分析随着clk脉冲信号的不断到来,countmiao记录出clk的脉冲个数,计数到59时, 在下一个clk脉冲信号到来时,输出端enfen输出高定平,即向分进位,同时countmiao 清零。2、reset为清零端,reset低电平时,当countmiao计数从零重新开始计数。3、 setfen为分的手动进位端,当setfen高定平时且clk脉冲到来时,输出enfen高电平,向 分进位。. (1)分计数器(fen)VHDL程序描述library ieee;use ieee.std_logic_1164.all

8、;use ieee.std_logic_unsigned.all;entity fen is port(imiao,clk,reset,setshi:in std_logic;enshi:out std_logic;countfen:out std_logic_vector(7 downto 0);end fen;architecture fun of fen is signal enshi_1,enshi_2:std_logic; signal count:std_logic_vector(7 downto 0);begincountfen=count; enshi_2=(setshi an

9、d clk);enshi=(enshi_1 or enshi_2);process(imiao,reset,setshi)beginif(reset=0) thencount=00000000;elsif(imiaoevent and imiao=1) thenif(count(3 downto 0)=1001) thenif(count16#60#) thenif(count=01011001) thencount=00000000;enshi_1=1;else count=count+7;end if; else count=00000000;end if;elsif(count16#60

10、#) thencount=count+1;enshi_1=0;else count=00000000;end if;end if;end process;end fun;(2)分计数器(fen)仿真波形图耐Mni -l-lPcirA.IakbM利.窝修时乱器 HL.0 H耐Mni -l-lPcirA.IakbM利.窝修时乱器 HL.0 H分计数器(fen)仿真分析imiao为秒计数器的enfen进位输出端,当enfen (imiao)高电平到来时,clk高电 平时,且countfen开始计数。countfen计数到59时,下一个enfen(imiao)、clk到 来时,enshi高电平,即向时

11、进位,同时countfen清零。2、reset为清零端,当reset低 电平时,countfen计数从零重新开始计数。3、setshi为时的手动进位端,当setshi高定 平时且clk脉冲到来时,输出en时高电平,向时进位。.(1)时计数器(shi)VHDL程序描述library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity shi isport(ifen,reset:in std_logic;countshi:out std_logic_vector(7 downto 0);end shi;ar

12、chitecture fun of shi issignal count:std_logic_vector(7 downto 0);begin countshi=count;process(ifen,reset)beginif(reset=0) thencount=00000000;elsif(ifenevent and ifen=1) thenif(count(3 downto 0)=1001) thenif(count16#23#) then count=count+7;else count=00000000;end if;elsif(count16#23#) thencount=coun

13、t+1;else count=00000000;end if;end if;end process;end fun;(2)时计数器(shi)仿真扫描显示译码器(saomiao)仿真逋M fX逋M fX(3)时计数器(shi)仿真分析ifen为分计数器的enshi进位输出端,当enshi (ifen)为高电平时,countshi计数。 countshi计数到23时,当下一个enshi(ifen)、clk到来时,countshi会自动清零。2、 reset为清零端,当reset低电平时,countfen计数从零重新开始计数。.整点报时(1)整点报时器(baoshi)VHDL程序描述library

14、ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entitybaoshi is port( clk:in std_logic; inputmiao,inputfen:in std_logic_vector(6 downto 0); output:out std_logic_vector(1 downto 0) ); end baoshi; architecture fun of baoshi is signal temp:std_logic_vector(1 downto 0); signal nummia

15、o,numfen:std_logic_vector(7 downto 0); begin nummiao=inputmiao; numfen=inputfen; outputtemptemptemptemptemp=00; end case; end if; end if; end process; end fun; 11(2)整点报时器(baoshi)仿真波形图裁I制融制国S: Ei. .i.如 裁I制融制国S: Ei. .i.如 lie .StartEMT3 -IJ .j 一。1T3 -IJ .j 一。1“更碘酮遏酶使电颜国酶被使够酶画谑逊运电电艇回电距酗i运电蟠破诞鹿电芭酶题gfi碗运碘

16、近因酶 Ln_n_n_rLrLrLrLn_n_rLn_n_n_r_rLrLn_rLn_n_n_rLrLrLn_n_rLrLrLrLrLn_rLn_n_rL 一-Ln_n_n_n_n_n_n_n_n_n_rLn_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_rLn_rLrLi r -r n - 一.一 一.一一 一一.一 r n 一.一 一一. _Ln_n_rLrL_Ln_n_n_n_rLn_rLr_r_rLrLn_n_nj_L_L_i_n_n_n_n_rLrLr_rj-LrLrLn_n_n_ Ln_rLrLnL_Ln_rLn_n_rLn_rLr_r_rLrLn

17、_n_nj_L_L_Ln_n_n_n_rLrLr_r_rLrLrLn_n_n_ 口 Tjn_n_rLn_n_n_n_n_n_n_rLn_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_n_rLn_n_rLn_rLrLi LrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLTLrLrLrLrLrL r - - - - - .r - -.n - - 一.一 一.一一 一一.一 r n 一.一 一一.(3)整点报时器(baoshi)仿真分析input为分计数器的输出端,当输出58、59和00(十六进制)时,整点报时

18、器(baoshi) 的输出端output为高电平,点亮LED灯。当intput为58、59时,点亮一个LED灯, 当input为00时,点亮两个LED灯。其他情况时,LED灯均不发光。(1)分频器(fenpin)设计 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity fenpin isport( clk_5M:in std_logic;clk:out std_logic );end fenpin;architecture fun of fenpin is signal count:s

19、td_logic_vector(22 downto 0); beginprocess(clk_5M)beginif (clk_5Mevent and clk_5M=1) thenif(count=10011000100101100111111) thencount=00000000000000000000000;clk=1;else count= count+1;clk=0;end if;end if;end process;end fun;(1)扫描显示译码器(saomiao) VHDL程序描述扫描显示译码器是用来显示时钟数值的装置,将数字时钟的高低电平信号用数码管的数值 显示出来。八个数码

20、管中,用六个数码管显示时、分和秒,另外两个可做为时和分、分和 秒之间的间隔,始终不显示。首先对八个数码管进行扫描,每一时刻都只有一个数码管处 于扫描状态,并将此时的数字时钟的高低电平通过十六进制的BCD码转换为数码管显示 数值。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity saomiao isport(clk_smxs:in std_logic;shi:in std_logic_vector(7 downto 0);fen:in std_logic_vector(7 downto

21、0);miao:in std_logic_vector(7 downto 0);selout:out std_logic_vector(7 downto 0);segout:out std_logic_vector(6 downto 0);end saomiao;architecture fun of saomiao issignal temp:std_logic_vector(2 downto 0);signal seg:std_logic_vector(6 downto 0);signal sel:std_logic_vector(7 downto 0);beginselout=sel;s

22、egout=111 then temp=000;else tempnum:=shi(7 downto 4);selnum:=shi(3 downto 0); selnum:=fen(7 downto 4);selnum:=fen(3 downto 0); selnum:=miao(7 downto 4);selnum:=miao(3 downto 0);selselsegsegsegsegsegsegsegsegsegsegseg=0000000;end case;end if;end process;end fun;oocmw。,m J. 口 mooi 口miKELI工 EJXUEB Itr

23、iul: E DCdl ODlXDOO*iQI J oocmw。,m J. 口 mooi 口miKELI工 EJXUEB Itriul: E DCdl ODlXDOO*iQI J l id I1 PCI j?KLDn出口。 S 2皿 n khh Aairt琴6.数字时钟整体设计、数字时钟整体设计: (1)数字时钟的电路原理图:数千时钟的电路仿真波形图.I .匕翘 ”E ”A 即 Uf 三 T 埠 Ul.ff QL泣 II .=”0 5正柒川li tr W._L2i_L2r- r 匚门丁丁=-1_1_1_11_11/1_0_|_07151_11/1_0_1_0_0_1_1_|_0_1_0_1_1

24、_1-_1:1门_0_1_15_*1 | r4 Md, ; 一 一 一 一 :一 一 2 I 3 91-ila t次4 1 B nApr H iH ::39 ”wii 万 11_w_嬴h 府(incgiYyiriTirTWKgixwx?nfsyirxgi?TiEy xgrys7?nygjgxfa 口 OTfinywxxgirxwx1数字时钟整体设计:时钟脉冲源为EDA实验箱中的5MHz的脉冲信号,用于分频器的输入信号和扫 描显示译码器的扫描。分频器的功能是将5MHz的脉冲信号转换为1Hz的时钟信号,用 于秒的计数。秒为60进制计数器,当1Hz的脉冲信号来临时,开始计数。计数到59时, 会输出enfen高电平,用于分的计数。setfen为手动进位端,置入高电平时也会使enfen 产生高电平。分计数器为60进制计数器,当enfen高电平来临时,分计数器会开始计数, 计数到59时,会产生enshi的高电平。setshi为手动置 数端,当setshi高定平时,也会 使enshi为高电平。enshi为时计数器的计数脉冲输入,enshi高电平时,时计数器开始计 数。时计数器为24进制计数器,计数到24时会自动清零。reset为异步清零端,高定 平时,所有时钟显示数码管均为0。selout为数码管扫描

温馨提示

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

评论

0/150

提交评论