ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:1.26MB ,
资源ID:8761777      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8761777.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(带有校时功能地数字闹钟.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

带有校时功能地数字闹钟.docx

1、带有校时功能地数字闹钟电子课程设计-带有校时功能的数字闹钟 一、设计任务与要求 -3-二、总体框图 -3-三、选择器件 -4四、功能模块 -41、分频器div_clk模块-42、秒计时second模块-53、分计时minute模块-74、小时计时hour模块-85、寄存jicun模块-106、选择时间输出time_show模块-127、闹钟响时长控制time_control模块-148、闹钟控制naozhong模块-159、扫描seltime模块-1710、数码管显示deled模块-1911、3-8译码器 decode3_8模块-20五、总体设计电路图 1、总体电路原理图-22-2、总体电路仿

2、真图-23- 3、管脚分配-24- 4、硬件验证情况-24-六、心得体会 26带有校时功能的数字闹钟一、设计任务与要求1、具有时、分、秒显示功能,以二十四小时循环计时。2、具有稳定的校时功能(预置数法),具有调时调分的功能,可调至任意时、分进行校时。3、具有闹钟功能,实现分/时闹钟设置,闹钟起闹时间为3s-5s,并在此时间段可手动调节。附加功能:具有再整点报时功能,整点报时的同时led灯花样显示。二、总体框图上图为总体设计框图,主要有计数模块,闹钟模块和扫描译码显示模块组成。分频器在外部时钟信号的作用下实现分频后将其分频信号分别输出给计数模块和扫描模块。在分频信号(秒脉冲)作用下计数模块实现计

3、数功能实现24小时计数功能,但其计数功能是在以BCD码形式所记录的。这就需要扫描电路去扫描计数模块所输出的时间在500HZ脉冲下经过译码器将其译成共阴数码管所对应的二进制数进行显示,最终显示的为24小时时钟。若有闹钟信号进入时,其闹钟信号经过计数控制有一二进制数经过扫描电路译码电路数码管后,最终显示闹钟时间。之后闹钟信号无作用后显示时钟信号。闹钟时间与正常时间相同后外部控制响铃信号控制响铃时间。外部时间控制信号可控制时间的校验。三、 选择器件1、pc机一台。2、CPLD/FPGA适配器板:标准配置EPF10K10LC84-4接口板,下载接口是数字芯片的下载接口(DIGITAL JTAG),主要

4、用于CPLD/FPGA芯片的数据下载。3、实验箱:装有七段数码管及蜂鸣器等,七段数码管字形及真值表如下七段数码管字形如下:七段数码管真值表如下: 表1 七段数码管真值表、四、 功能模块各个功能模块及作用如下1)、分频器div_clk模块其程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity clk_div isport(clk_in:in std_logic;div_outa,div_outb:out std_logic);end clk_div;architecture a o

5、f clk_div issignal fre_na:integer range 0 to 50000000;signal fre_nb:integer range 0 to 100000;signal clk_tmpa:std_logic;signal clk_tmpb:std_logic;begindiv_outa=clk_tmpa;div_outb49999999 thenfre_na=0;clk_tmpa=not clk_tmpa;elsefre_na99999 thenfre_nb=0;clk_tmpb=not clk_tmpb;elsefre_nb=fre_nb+1;end if;e

6、nd if;end process;end a;该模块实现的功能是分频。clk_in 输入一个50MHZ的脉冲信号,经过分频器后得到一个1HZ的秒脉冲和一个500HZ的脉冲信号。2)、秒计时second模块其程序如下: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 enti

7、ty second;architecture fun of second issignal count:std_logic_vector(6 downto 0);begindaout=count;process(clk,reset,setmin)beginif(reset=0)thencount=0000000;elsif(setmin=0)thenenmin=clk;elsif(clkevent and clk=1)thenif(count(3 downto 0)=1001)thenif(count16#60#)thenif(count=1011001)thenenmin=1;count=0

8、000000;elsecount=count+7;end if;elsecount=0000000;end if;elsif(count16#60#)thencount=count+1;enmin=0 after 100 ns;elsecount=0000000;end if;end if;end process;end fun;该模块的功能是秒计时及分校验(置分)。reset为复位信号低电平有效。当有时钟信号(秒脉冲)进来后进行加计数,计数为六十进制。当计数满59后,下一时钟来临后进位信号enmin输出一个脉冲信号。当分校验信号setmin有一脉冲信号进来后,enmin有一脉冲信号。其仿真图

9、为:3)、分计时minute模块其程序如下:Library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity minute isport(clk,clk1,reset,sethour:in std_logic; enhour: out std_logic;daout:out std_logic_vector(6 downto 0);end entity minute;architecture fun of minute issignal count:std_logic_vector(6 downto

10、0);begindaout=count;process(clk,reset,sethour)beginif(reset=0)thencount=0000000;elsif(sethour=0)thenenhour=clk1;elsif(clkevent and clk=1)thenif(count(3 downto 0)=1001)thenif(count16#60#)thenif(count=1011001)thenenhour=1;count=0000000;elsecount=count+7;end if;elsecount=0000000;end if;elsif(count16#60

11、#)thencount=count+1;enhour=0 after 100 ns;elsecount=0000000;end if;end if;end process;end fun;该模块的功能是分计时及时校验(置时)。reset为复位信号低电平有效。秒进位信号进入clk作为脉冲信号进行计数,计数为六十进制。当计数满59后,下一时钟来临后进位信号enhour输出一个脉冲信号。当分校验信号sethour有一脉冲信号进来后,enhour有一脉冲信号。其仿真图为:4)小时计时hour模块其程序如下:library ieee;use ieee.std_logic_1164.all;use iee

12、e.std_logic_unsigned.all;entity hour ISport(clk,reset:IN STD_LOGIC;daout:out std_logic_vector(5 downto 0);end entity hour;architecture fun of hour issignal count:std_logic_vector(5 downto 0);begindaout=count;process(clk,reset)beginif(reset=0)thencount=000000;elsif(clkevent and clk=1)thenif(count(3 d

13、ownto 0)=1001)thenif(count16#23#)thencount=count+7;elsecount=000000;end if;elsif(count16#23#)thencount=count+1;elsecount=000000;end if;end if;end process;end fun;该模块的功能是小时计时。reset为复位信号低电平有效。分进位信号进入clk作为脉冲信号进行计数,计数为二十四进制。当计数记到二十三,下一个有效脉冲来临后,下一个状态变为零,之后正常计数。其仿真图为:5)、寄存jicun模块其程序如下:library ieee;use iee

14、e.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jicun isport(rst,setm,seth:in std_logic; mo:out std_logic_vector(6 downto 0); ho:out std_logic_vector(5 downto 0);end jicun;architecture one of jicun issignal m:std_logic_vector(6 downto 0);signal h:std_logic_vector(5 downto 0);beginprocess

15、(rst,setm)beginmo=m;if rst=0 then if (setmevent and setm=1)then if(m(3 downto 0)=1001)then if(m16#60#)then if(m=1011001)then m=0000000; else m=m+7; end if; else m=0000000; end if; elsif(m16#60#)then m=m+1;else m=0000000; end if;end if;end if;end process;process(rst,seth)beginho=h;if rst=0 thenif (se

16、thevent and seth=1)thenif(h(3 downto 0)=1001)thenif(h16#23#)thenif(h=100011)thenh=000000;elseh=h+7;end if;elseh=000000;end if;elsif(h16#23#)thenh=h+1;else h=000000;end if;end if;end if; end process;end one;该模块的功能是定时及寄存该闹钟时间。rst为控制闹钟信号输入,rst=0时setm和seth以脉冲信号计数来置入闹钟时间,当setm和seth不变时将其保存,且可以在rst=0时查看闹钟时

17、间。其输出信号时和分分别用BCD码表示。其仿真图为:6)、选择时间输出time_show模块其程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity time_show isport(rst,reset:in std_logic; setm:in std_logic_vector(6 downto 0); seth:in std_logic_vector(5 downto 0); mi:in std_logic_vector(6 downto 0); hi:in std_logic

18、_vector(5 downto 0); daouth:out std_logic_vector(5 downto 0); daoutm:out std_logic_vector(6 downto 0);end time_show;architecture one of time_show isbeginprocess(reset,rst,setm)beginif reset=0 then daoutm=0000000; else if rst=1 then daoutm=mi; elsif rst=0 then daoutm=setm;end if;end if;end process;pr

19、ocess(reset,rst,seth)beginif reset=0 then daouth=000000; else if rst=1 then daouth=hi; elsif rst=0 then daouth=seth;end if;end if;end process;end one;该模块的功能是选择显示时间是正常时间还是闹钟时间。reset为复位信号低电平有效。其中setm和seth分别为寄存器输出的闹钟时间,mi和hi分别为正常时钟时间,rst为选择信号,当rst=0是选择闹钟时间作为输出,否则选择时钟时间作为输出。daouth和daoutm分别为输出信号的时和分其仿真图为

20、:7)、闹钟响时长控制time_control模块其程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity time_control is port(a1,b1,c1:in std_logic; control_out:out std_logic_vector(6 downto 0);end time_control;architecture a of time_control isbeginprocess(a1,b1,c1) begin if a1=0 then control_

21、out=0000011; elsif b1=0 then control_out=0000100; elsif c1=0 then control_out=0000101; else control_out=0000011; end if; end process;end a;该模块的功能是输入声响时长。a1,b1,c1三个信号控制蜂鸣器响的时间分别为3s、4s、5s,其中a1优先权最高。其控制的输出control_out为BCD码作为闹钟模块的秒比较控制蜂鸣器响的时间长度。其仿真图为:8)、闹钟控制naozhong模块其程序如下:library ieee;use ieee.std_logic

22、_1164.all;use ieee.std_logic_unsigned.all;entity naozhong isport(setm,mi,ms,q:in std_logic_vector(6 downto 0); seth,hi:in std_logic_vector(5 downto 0); clk:in std_logic; speaker:out std_logic;lamp: out std_logic_vector (2 downto 0);end naozhong;architecture one of naozhong is signal speaker1:std_log

23、ic; signal speaker2:std_logic; signal count:std_logic_vector(1 downto 0); signal count1,count2:std_logic; signal h: std_logic_vector(5 downto 0); signal m: std_logic_vector(6 downto 0);beginspeaker=speaker1 or speaker2 ;h=seth;m=setm;speakera:process(clk)beginspeaker1=count1;if(clkevent and clk=1)th

24、enif(mi=0000000)thenif(msq)thencount1=1 ;elsecount1=0;end if;end if;end if;end process speakera;speakerb:process(setm,seth)beginspeaker2=count2;if(clkevent and clk=1)then if(mi=m)and(hi=h) then if(msq)then count2=1; else count2=0; end if;end if;end if;end process speakerb;lamper:process(clk)beginif(

25、rising_edge(clk)then if(mi=0000000)then if(count=10)then if(count=00)then elsif(count=01)then lamp=010; elsif(count=10)then lamp=100; end if; count=count+1;elsecount=00;end if;else lamp=000;end if; end if;end process lamper;end one;该模块实现三个功能:闹钟、整点报时、花样显示。闹钟:闹钟时间时分seth、setm与正常时钟时间时分hi、mi比较,相等且响控信号q时钟

26、秒时间ms时蜂鸣器响,由此可控制响的时间长度。整点报时:当时钟时间mi为0时即为整点,且响控信号q时钟秒时间ms时蜂鸣器响,由此可控制响的时间长度。花样显示:当整点时lamper灯有一花样显示。其仿真图为:9)、扫描seltime模块其程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity seltime isport(clk1,reset:in std_logic;sec,min:in std_logic_vector(6

27、 downto 0);hour:in std_logic_vector(5 downto 0);daout:out std_logic_vector(3 downto 0);sel:out std_logic_vector(2 downto 0);end seltime;architecture fun of seltime issignal count:std_logic_vector(2 downto 0);beginsel=count;process(clk1,reset)beginif(reset=0)thencount=101)thencount=000;elsecountdaoutdaout(3)=0;daout(2 downto 0)daoutdaout(3)=0;

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1