数字逻辑电路设计_第1页
数字逻辑电路设计_第2页
数字逻辑电路设计_第3页
数字逻辑电路设计_第4页
数字逻辑电路设计_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

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

文档简介

PAGEPAGE14数字逻辑电路设计——-——数字钟学院:京江学院专业:软件工程姓名:李永乐学号:4131169055指导老师:赵念强201设计任务及要求(1)拥有正常的时、分、秒计时功能。(2)能利用实验箱的开关实现校时、校分及清零功能。(3)能利用实验板上的扬声器做整点报时。(4)采用VHDL语言或画图方法进行设计。(5)在完成全部电路设计后下载到实验箱,验证设计课题的正确性。多功能数字钟的总体设计和顶层原理图整个系统分为五个模块来实现,分别是计时模块、校时模块、整点报时模块、分频模块、动态显示模块。1计时模块1).计时——24进制计数器libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt24isport(clk:instd_logic;ql:outstd_logic_vector(3downto0);qh:outstd_logic_vector(3downto0);c:outstd_logic);endcnt24;architectureoneofcnt24isbeginprocess(clk)variableqi:std_logic_vector(7downto4);variableqj:std_logic_vector(3downto0);beginif(clk'eventandclk='0')thenif(qi="0010"ANDqj="0011")thenc<='1';qi:="0000";qj:="0000";elsec<='0';qj:=qj+1;if(qj<9)thenqj:=qj+1;elseqj:="0000";if(qi<2)thenqi:=qi+1;elseqi:="0000";endif;endif;endif;endif;qh<=qi;ql<=qj;endprocess;endone;2).计分计秒——60进制计数器libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt60isport(clk:instd_logic;clr:instd_logic;ql:bufferstd_logic_vector(3downto0);qh:bufferstd_logic_vector(3downto0);c:outstd_logic);endcnt60;architectureoneofcnt60isbeginc<='1'when(qh="0101"andql="1001")else'0';process(clk,clr)variableqi:std_logic_vector(7downto4);variableqj:std_logic_vector(3downto0);beginif(clr='0')thenqi:="0000";qj:="0000";elsif(clk'eventandclk='1')thenif(qj<9)thenqj:=qj+1;elseqj:="0000";if(qi<5)thenqi:=qi+1;elseqi:="0000";endif;endif;endif;ql<=qj;qh<=qi;endprocess;endone;2校时模块1).选择计时或校时——2路选择器(计时采用1HZ的脉冲驱动计数器计数,而校时则需要较高频率的信号驱动以达到快速校时的目的)libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitymux2_1isport(a,b,s:instd_logic;y:outstd_logic);endmux2_1;architecturebhvofmux2_1isbeginy<=awhens='0'elseb;endbhv;.利用按键实现“校时”、“校分”和“秒清0”功能((1)SA:校时键。按下SA键时,时计数器迅速递增,按24小时循环,并且计满23时回到00。(2)SB:校分键。按下SB键时,分计数器迅速递增,按60小时循环,并且计满59时回到00,但不向时进位。(3)SC:秒清零。按下SC时,秒计数器清零。3分频模块这个系统需要很多种不同频率的脉冲信号,这些均可以通过一个基准频率分频器生成。分频器就是一个进制很大的计数器,利用计数器的分频功能,从不同的输出位得到所需要的脉冲信号。libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityfreqdividerisport(clk:instd_logic; hz512,hz64,hz4,hz1:outstd_logic);endfreqdivider;architecturefoffreqdividerissignalcc:std_logic_vector(9downto0);beginprocess(clk)beginif(clk'eventandclk='1')thenif(cc="1111111111")thencc<="0000000000";elsecc<=cc+1;endif;endif;endprocess;hz512<=cc(0);hz64<=cc(3);hz4<=cc(7);hz1<=cc(9);endf;4整点报时模块从59分50秒开始,每过2秒进行低音报时,当达到整点时,进行一次高音报时libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityzdbsisport(mh,ml,sh,sl:instd_logic_vector(3downto0);sig500,sig1k:outstd_logic);endzdbs;architectureaofzdbsisbeginsig500<='1'when(mh="0101"andml="1001"andsh="0101"and(sl="0010"orsl="0100"orsl="0110"orsl="1000"))else'0';sig1k<='1'when(mh="0000"andml="0000"andsh="0000"andsl="0000")else'0';enda;5动态扫描模块24进制(时)与60进制(分、秒)计数器的输出分成6组,每一组(4位BCD码)接BCD-7段码显示译码器(动态显示只需1个),驱动数码管显示。选用8个数码管中的6个作为时间显示。libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydt_smisport(clk:instd_logic;h,m,s:instd_logic_vector(7downto0);seg7out:outstd_logic_vector(6downto0);sel:bufferstd_logic_vector(2downto0));enddt_sm;architecturebehaofdt_smissignalkey:std_logic_vector(3downto0);beginprocess(clk)variabledount:std_logic_vector(2downto0):="000";beginif(rising_edge(clk))thenifdount="101"thendount:="000";elsedount:=dount+1;endif;endif;sel<=dount;endprocess;PROCESS(sel)BEGINCASEselISwhen"000"=>key<=h(7downto4);when"001"=>key<=h(3downto0);when"010"=>key<=m(7downto4);when"011"=>key<=m(3downto0);when"100"=>key<=s(7downto4);when"101"=>key<=s(3downto0);whenothers=>null;ENDCASE;ENDPROCESS;PROCESS(key)BEGINcasekeyiswhen"0000"=>seg7out<="0111111";when"0001"=>seg7out<="0000110";when"0010"=>seg7out<="1011011";when"0011"=>seg7out<="1001111";when"0100"=>seg7out<="1100110";

温馨提示

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

评论

0/150

提交评论