基于VHDL的电子时钟设计(附代码和仿真波形)ppt课件_第1页
基于VHDL的电子时钟设计(附代码和仿真波形)ppt课件_第2页
基于VHDL的电子时钟设计(附代码和仿真波形)ppt课件_第3页
基于VHDL的电子时钟设计(附代码和仿真波形)ppt课件_第4页
基于VHDL的电子时钟设计(附代码和仿真波形)ppt课件_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

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

文档简介

电子时钟设计,1,设计要求,设计一个电子时钟。要求可以显示时、分、秒。用户可以设置时间。,2,系统组成,系统可以分为以下模块:1.10进制可预置计数器模块2.6进制可预置计数器模块3.24进制可预置计数器模块4.LED译码模块,3,系统组成方框图,4,1.10进制可预置计数器模块,时钟由时、分、秒组成,分、秒都为60进制。由于需要使用LED显示时间,所以采用的计数器应该是10进制的,从而方便译码模块的通用。而60进制计数器可以由10进制计数器和6进制计数器组成。,5,2.6进制可预置计数器模块,要组成一个可预置的60进制计数器,还需要一个6进制的计数器,使用10进制的进位作为6进制的计数器的时钟信号可以组成一个60进制的计数器。,6,24进制可预置计数器模块,时钟的小时是24进制的,所以必须设计一个24进制的可预置计数器。显然,24进制计数器不可以使用6进制计数器和4进制计数器组成,因为这样做的24进制计数器将给译码带来麻烦。,7,4.译码显示模块,一共有6个LED需要显示,所以需要6个译码模块。,8,电子时钟设计与仿真,9,10进制计数器VHDL程序,-文件名:counter10.vhd。-功能:10进制计数器,有进位C-最后修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter10isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(3downto0);dout:outstd_logic_vector(3downto0);c:outstd_logic);endcounter10;architectureBehavioralofcounter10issignalcount:std_logic_vector(3downto0);,10,begindout=count;process(clk,reset,din)beginifreset=0thencount=din;c=0;elsifrising_edge(clk)thenifcount=1001thencount=0000;c=1;elsecount=count+1;c=0;endif;endif;endprocess;endBehavioral;,11,10进制计数器仿真,12,6进制计数器VHDL程序,-文件名:counter6.vhd。-功能:6进制计数器,有进位C-最后修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter6isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(2downto0);dout:outstd_logic_vector(2downto0);c:outstd_logic);endcounter6;architectureBehavioralofcounter6issignalcount:std_logic_vector(2downto0);begin,13,process(clk,reset,din)beginifreset=0thencount=din;c=0;elsifrising_edge(clk)thenifcount=101thencount=000;c=1;elsecount=count+1;c=0;endif;endif;endprocess;dout=count;endBehavioral;,14,6进制计数器仿真,15,24进制计数器VHDL程序,-文件名:counter24.vhd。-功能:24进制计数器。-最后修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter24isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(5downto0);dout:outstd_logic_vector(5downto0);endcounter24;architectureBehavioralofcounter24issignalcount:std_logic_vector(5downto0);begin,16,process(clk,reset,din)beginifreset=0thencount=din;elsifrising_edge(clk)thenifcount(3downto0)=1001thencount(3downto0)=0000;count(5downto4)=count(5downto4)+1;elsecount(3downto0)=count(3downto0)+1;endif;ifcount=100011thencountdins(3downto0),dout=doutsl,c=c1);u2:counter6portmap(clk=c1,reset=reset,din=dins(6downto4),dout=doutsh,c=c2);u3:counter10portmap(clk=c2,reset=reset,din=dinm(3downto0),dout=doutml,c=c3);u4:counter6portmap(clk=c3,reset=reset,din=dinm(6downto4),dout=doutmh,c=c4);,23,u5:counter24portmap(clk=c4,reset=reset,din=dinh,dout=douth);u6:decoderportmap(din=doutsl,dout=secondl);-秒的低位u7:decoderportmap(din=rdoutsh,dout=secondh);-秒的高位u8:decoderportmap(din=doutml,dout=minutel);-分的低位u9:decoderportmap(din=rdoutmh,dout=minuteh);-分

温馨提示

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

评论

0/150

提交评论