欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    vhdl课程设计电子钟闹铃.docx

    • 资源ID:6053669       资源大小:118.20KB        全文页数:22页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    vhdl课程设计电子钟闹铃.docx

    1、vhdl课程设计电子钟闹铃数字钟的设计一、系统功能概述(一)、系统实现的功能:1、具有“时”、“分”、“秒”的十进制数字显示(小时从 00 23 )。2、具有手动校时、校分、校秒的功能。3、有定时和闹钟功能,能够在设定的时间发出闹铃声。4、能进行整点报时。从 59分 50秒起,每隔 2秒发一次低音“嘟”的信号,连 续 5 次,最后一次为高音“嘀”的信号。(二)、各项设计指标:1显示部分采用的6个LED显示器,从高位至低位分别显示时、分、秒。2、 有一个设置调闹钟定时时间、正常时间的按钮,选择调的对象。3、 有三个按钮分别调时、分、秒的时间。4、 有一个按钮用作开启 / 关闭闹铃。5、另外需要两

    2、个时钟信号来给系统提供脉冲信号,使时钟和闹钟正常工作,分别为1Hz、1kHz的脉冲。二、系统组成以及系统各部分的设计1、系统结构描述 / 要求:系统(或顶层文件)结构描述,各个模块(或子程序) 的功能描述;(一) 系统的顶层文件:1、 顶层文件图:(见下页)2、 各模块的解释:1)、7 个输入量 clk_1khz 、clk_1hz 、key_slt 、key_alarm 、sec_set 、min_set 、hour_set :其中 clk_1khz 为闹铃模块提供时钟,处理后能产生“嘟” 、“嘀”和变化的 闹铃声音; clk_1hz 为计时模块提供时钟信号,每秒计数一次; key_slt 选

    3、择设 置对象: 定时或正常时间; key_alarm 能够开启和关闭闹铃; sec_set 、min_set 、 hour_set 用于设置时间或定时,与 key_slt 相关联。各按键输出为脉冲信号。(2)、CNT60_A_SE模块:这个模块式将 clk_1hz 这个时钟信号进行 60 进制计数,并产生一个分钟的触发信号。该模块能将当前计数值实时按 BCD码的格式输出。将该输出接到两位 LED数码后能时时显示秒的状态。通过alarm_clk可以选择设置对象为时间还是 定时值。在设置时间模式上, key 上的一个输入脉冲可以将 clk 的输入信号加一。 在设置定时模式上, key 上的脉冲只修

    4、改定时值,不影响时间脉冲 clk 的状态。同时该模块具有两个输出口 out_do 、 out_di 来触发整点报时的“嘟” 、“嘀”声音。(3)、CNT60_A_MlN模块:这个模块式将CNT60_A_SE的输出信号进行60进制计数,并产生一个时位 的触发信号。该模块能将当前计数值实时按 BCD码的格式输出。将该输出接到两 位 LED 数码后能时时显示分的状态。 通过 alarm_clk 可以选择设置对象为时间还 是定时值。在设置时间模式上, key 上的一个输入脉冲可以将 clk 的输入信号加 一。在设置定时模式上, key 上的脉冲只修改定时值,不影响时间脉冲 clk 的状 态。同时该模块

    5、具有三个输出口 out_do 、 out_di 、 out_alarm 来触发整点报时的 “嘟”、“嘀”、闹铃声音。(4)、CNT24_A_H01模块:这个模块式将CNT60_A_MlN勺输出信号做24进制计数。该模块能将当前计 数值实时按BCD码的格式输出。将该输出接到两位LED数码后能时时显示时的状 态。通过 alarm_clk 可以选择设置对象为时间还是定时值。在设置时间模式上, key 上的一个输入脉冲可以将 clk 的输入信号加一。在设置定时模式上, key 上 的脉冲只修改定时值,不影响时间脉冲 clk 的状态。同时该模块具有一个输出口 out_alarm 来触发整点报时的闹铃声音

    6、。(5)、PWM_01模块:该模块为PWM产生模块,通过EN可幵启和关闭PWM输出。模块根据 CLK信 号二分频产生的高低音,并组合,能输出三种声音状态“嘟” 、“嘀”、闹铃。而该三种声音要被秒、分、时的输出触发才能输出 PWM。(二)系统各个模块的VHDLS序:(1)、CNT60_A_SE模块:程序源代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60_a_sec isport(使能端模式、时间调节模式co: out std_logic; -进位输出,触发分计数模块

    7、out_do: out std_logic;-在整点报时中输出“嘟”触发信号out_di: out std_logic -在整点报时中输出“嘀”触发信号);end;architecture a of cnt60_a_sec issignal qout2_l:std_logic_vector(3 downto 0);signal qout2_h:std_logic_vector(3 downto 0);signal alarm_l:std_logic_vector(3 downto 0);signal alarm_h:std_logic_vector(3 downto 0);signal clk

    8、1,clk2,tclk,aclk,ac_slt: std_logic;beginprocess(alarm_clk) - 当该端口输入一个脉冲时,修改设置模式:时间调整或 闹铃模式切换 beginif alarm_clkevent and alarm_clk=1 thenac_slt=1;elseac_slt=0;end if;end if;end process;begin时间调整模式if ac_slt=0 then -则 tclk=0 ,通过挖洞方式添加aclk=0;if clk=1 and key=1 then -clk=1一个脉冲tclk=0;elsif clk=0 and key=1

    9、 then -clk=0, 则 tclk=1, 产生一个高电平,添加一脉冲tclk=1;elsetclk=clk;end if;elsif ac_slt=1 then - 闹铃调整模式tclk=clk;aclk=key; -key 上的脉冲直接修改闹铃定时值end if;end process;process(tclk,clr,enb) -60 进制计数,个位、十位放在两个临时变量中,表示秒的状态beginif clr=1 then-clearing works at the state of high voltageqout2_l=0000;qout2_h=0000;elsif tclkev

    10、ent and tclk=1 thenif enb=1 then-enable works at high voltageif qout2_l=1001 and qout2_h=0101 thenqout2_l=0000;-a full mode is completed and a carryout is generatedqout2_h=0000;elsif qout2_l=1001 thenqout2_l=0000;qout2_h=qout2_h+1;elseqout2_l=qout2_l+1;- in process of countingend if;end if;end if;en

    11、d process;process(aclk,clr,enb)- 修改闹铃的定时值 beginif clr=1 then-clearing works at the state of high voltagealarm_l=0000;alarm_h=0000;elsif aclkevent and aclk=1 thenif enb=1 then-enable works at high voltageif alarm_l=1001 and alarm_h=0101 thenalarm_l=0000;-a full mode is completed and a carryout is gen

    12、eratedalarm_h=0000;elsif alarm_l=0101 thenalarm_l=0000;alarm_h=alarm_h+1;elsealarm_l=alarm_l+1;- in process of countingend if;end if;end if;end process;产生进位 , 显示时process(qout2_l,qout2_h,alarm_l,alarm_h,alarm_clk)-间或闹铃定时值beginif qout2_l=0000 and qout2_h=0000 thenco=1;elseco=0;end if;if ac_slt=0 then

    13、- 显示时间qout_sl=qout2_l;qout_sh=qout2_h;else - 显示定时值qout_sh=alarm_h;qout_sl=alarm_l;end if;end process;process(qout2_l,qout2_h) - 根据秒的状态输出“嘟” 、“嘀”触发信号beginif qout2_h=0101 thenif qout2_l=0000 thenout_do=1;elsif qout2_l=0010 thenout_do=1;elsif qout2_l=0100 thenout_do=1;elsif qout2_l=0110 thenout_do=1;el

    14、sif qout2_l=1000 thenout_do=1;elseout_do=0;elsif qout2_h=0000 then if qout2_l=0000 then out_di=1; out_do=0;elseout_di=0;end if;elseout_do=0;out_di=0;end if;end process;end;(2)、CNT60_A_MlN模块:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60_a_min isport(clk,clr,enb

    15、: in std_logic; -clk :时钟输入信号, clr :清零端, enb:使能端key: in std_logic; -输入按键脉冲,调整闹铃定时或时间alarm_clk: in std_logic; -1:alarm 0:clk - 设置模式选择:闹铃调节模式、时间调节模式qout_ml: out std_logic_vector(3 downto 0); - 显示输出分的低位qout_mh: out std_logic_vector(3 downto 0); - 显示输出分的高位co: out std_logic; -进位输出,触发时计数模块out_alarm:out std

    16、_logic;-闹铃触发信号,时间到后输出高电平触发闹铃out_do,out_di: out std_logic- 在整点报时中输出“嘟” “嘀”触发信号);end;architecture a of cnt60_a_min issignal qout2_l:std_logic_vector(3 downto 0);signal qout2_h:std_logic_vector(3 downto 0);signal alarm_l:std_logic_vector(3 downto 0);signal alarm_h:std_logic_vector(3 downto 0);signal cl

    17、k1,clk2,tclk,aclk,ac_slt: std_logic;beginprocess(alarm_clk) - 当该端口输入一个脉冲时,修改设置模式:时间调整或 闹铃模式切换beginif alarm_clkevent and alarm_clk=1 thenif ac_slt=0 then- 如果为定时模式,将改为闹铃模式ac_slt=1;elseac_slt=0;end if;end if;end process;process(key,clk,ac_slt) - 根据设置模式,处理 key 上的脉冲信号beginif ac_slt=0 then - 时间调整模式aclk=0;

    18、if clk=1 and key=1 then-clk=1 则 tclk=0 ,通过挖洞方式添加一个脉冲tclk=0;elsif clk=0 and key=1 then-clk=0, 则 tclk=1, 产生一个高电平,添加一脉冲tclk=1;elsetclk=clk;end if;tclk=clk;aclk=key; -key 上的脉冲直接修改闹铃定时值end if;end process;process(tclk,clr,enb) -60 进制计数,个位、十位放在两个临时变量中,表示分的状态beginif clr=1 then-clearing works at the state of

    19、 high voltageqout2_l=0000;qout2_h=0000;elsif tclkevent and tclk=1 thenif enb=1 then-enable works at high voltageif qout2_l=1001 and qout2_h=0101 thenqout2_l=0000;-a full mode is completed and a carryoutis generated qout2_h=0000;elsif qout2_l=1001 thenqout2_l=0000;qout2_h=qout2_h+1;elseqout2_l=qout2_

    20、l+1;- in process of counting end if;end if;end if;end process;process(aclk,clr,enb) - 修改闹铃的定时值beginif clr=1 then-clearing works at the state of high voltage alarm_l=0000;alarm_h=0000;elsif aclkevent and aclk=1 thenif enb=1 then-enable works at high voltageif alarm_l=1001 and alarm_h=0101 thenalarm_l

    21、=0000;-a full mode is completed and a carryout is generatedalarm_h=0000;elsif alarm_l=0101 thenalarm_l=0000;alarm_h=alarm_h+1;elsealarm_l=alarm_l+1;- in process of countingend if;end if;end if;end process;产生进位 , 显示process(qout2_l,qout2_h,alarm_l,alarm_h,alarm_clk) - 时间或闹铃定时值 of high voltage beginif

    22、qout2_l=0000 and qout2_h=0000 then co=1;elseco=0;end if;if ac_slt=0 thenqout_ml=qout2_l;qout_mh=qout2_h;elseqout_mh=alarm_h;qout_ml=alarm_l;end if;end process;-判断定时值与时间值相等,输process(qout2_l,qout2_h,alarm_l,alarm_h)出闹铃触发信号beginif qout2_l=alarm_l and qout2_h=alarm_h thenout_alarm=1;elseout_alarm=0;end

    23、if;end process;process(qout2_l,qout2_h) - 根据分的状态输出“嘟” 、“嘀”触发信号 beginif qout2_l=1001 and qout2_h=0101 thenout_do=1;elseout_do=0;end if;if qout2_l=0000 and qout2_h=0000 thenout_di=1;elseout_di=0;end if;end process;end;(3)、CNT24_A_HOUR块:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsign

    24、ed.all;entity cnt24_a_hour isport(使能端设置模式选择:闹铃调节模alarm_clk: in std_logic;-1:alarm 0:clk-式、时间调节模式显示输出时的低位qout_hl: out std_logic_vector(3 downto 0); -qout_hh: out std_logic_vector(3 downto 0); - 显示输出时的高位co: out std_logic; - 进位输出out_alarm:out std_logi- 闹铃触发信号输出);end;architecture a of cnt24_a_hour issig

    25、nal qout2_l:std_logic_vector(3 downto 0);signal qout2_h:std_logic_vector(3 downto 0);signal alarm_l:std_logic_vector(3 downto 0);signal alarm_h:std_logic_vector(3 downto 0);signal clk1,clk2,tclk,aclk,ac_slt: std_logic;beginprocess(alarm_clk) - 当该端口输入一个脉冲时,修改设置模式:时间调整或闹铃模式切换 begin如果为定时模式,将改为闹铃模式if al

    26、arm_clkevent and alarm_clk=1 thenif ac_slt=0 then-ac_slt=1;elseac_slt=0;end if;end if;end process;begintclk=0;添加一脉冲tclk=1;elsetclk=clk;end if;elsif ac_slt=1 then - 闹铃调整模式tclk=clk;aclk=key; -key 上的脉冲直接修改闹铃定时值end if;end process;process(tclk,clr,enb) -24 进制计数,个位、十位放在两个临时变量中,表示时的状态beginif clr=1 then-cle

    27、aring works at the state of high voltageqout2_l=0000;qout2_h=0000;elsif tclkevent and tclk=1 thenif enb=1 then-enable works at high voltageif qout2_l=1001 thenqout2_l=0000;-a full mode is completed and a carryout is generatedqout2_h=qout2_h+1;elsif qout2_l=0011 and qout2_h=0010 thenqout2_l=0000;qout

    28、2_h=0000;elseqout2_l=qout2_l+1;- in process of countingend if;end if;end if;end process;beginif clr=1 then-clearing works at the state of high voltage alarm_l=0000;alarm_h=0000;elsif aclkevent and aclk=1 thenif enb=1 then-enable works at high voltageif alarm_l=1001 then alarm_l=0000;-a full mode is

    29、completed and a carryoutis generatedalarm_h=qout2_h+1;elsif alarm_l=0011 and alarm_h=0010 then alarm_l=0000;alarm_h=0000;elsealarm_l=alarm_l+1;- in process of countingend if;end if;end if;end process;, 显示process(qout2_l,qout2_h,alarm_l,alarm_h,alarm_clk) - 产生进位时间或闹铃定时值 of high voltagebeginif qout2_l=0000 and qout2_h=0000


    注意事项

    本文(vhdl课程设计电子钟闹铃.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开