VHDL数字秒表设计_第1页
VHDL数字秒表设计_第2页
VHDL数字秒表设计_第3页
VHDL数字秒表设计_第4页
VHDL数字秒表设计_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

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

文档简介

1、.vhdl数字秒表设计 专 业: 自动化 班级学号: 5090629 姓 名: 刘丹 2011年 6 月14 日精品.vhdl语言课程设计-秒表设计一、设计实验目的:在max+plusii软件平台上,熟练运用vhdl语言,完成数字时钟设计的软件编程、编译、综合、仿真,使用eda实验箱,实现数字秒表的硬件功能。二、设计实验说明及要求:1、数字秒表主要由:分频器、扫描显示译码器、一百进制计数器、六十进制计数器(或十进制计数器与6进制计数器)、十二进制计数器(或二十四进制计数器)电路组成。在整个秒表中最关键的是如何获得一个精确的100hz计时脉冲,除此之外,数字秒表需有清零控制端,以及启动控制端、保

2、持保持,以便数字时钟能随意停止及启动。2、数字秒表显示由时(12或24进制任选)、分(60进制)、秒(60进制)、百分之一秒(一百进制)组成,利用扫描显示译码电路在八个数码管显示。3、能够完成清零、启动、保持(可以使用键盘或拨码开关置数)功能。4、时、分、秒、百分之一秒显示准确。三、我的设计思路: 1、四个十进制计数器:用来分别对百分之一秒、十分之秒、秒和分进行计数; 2、两个6进制计数器:用来分别对十秒和十分进行计数;3、一个24进制计数器,用来对小时进行计数; 3、分频率器:用来产生100hz的计数脉冲; 4、显示译码器:完成对显示译码的控制。精品.四、设计过程:1.分频器:由10mhz变

3、为100hz,10mhz的周期是10的(-7)次方,而100hz的周期是10的(-2)次方,而且方波是高低相间,只有高电平有效,所以100hz的周期需要取一半,即0.02秒,这样算出的分频倍数就是50000分频器代码:将10mhz脉冲变成100hz程序:library ieee;use ieee.std_logic_1164.all;entity fenpin isport(clr,clk: in bit;q: buffer bit);end fenpin;architecture a of fenpin is signal counter:integer range 0 to 49999;b

4、egin process(clr,clk) beginif (clk=1 and clkevent) then if clr=1 then counter=0;elsif counter=49999 then counter=0; q= not q;else counter=counter+1; end if; end if; end process精品.;end a;分频器的仿真图:2.十进制计数器:原理为加法计数器,从0加到9,计到10个数时由cout进位程序:library ieee; use ieee.std_logic_1164.all;use ieee.std_logic_unsi

5、gned.all;entity c10 is port(clr,start,clk: in bit;cout: out bit;daout: out std_logic_vector(3 downto 0);end c10;精品.,architecture a of c10 is signal temp:std_logic_vector(3 downto 0);begindaout=temp;process(clk,clr)begin if clr=1 then temp=0000; cout=1001 then temp=0000;cout=1; else temp=temp+1; cout

6、=0; end if; end if; end if; end process;end a;精品.十进制计数器仿真图:3.六进制计数器:原理为加法计数器,从0 加到5计到第六个数时由cout进位。程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;精品.entity c6 is port(clr,start,clk: in bit; daout: out std_logic_vector(3 downto 0); cout: out std_logic);end c6;architecture

7、a of c6 is signal temp:std_logic_vector(3 downto 0);begindaout=temp; process(clk,clr) begin if clr=1 then temp=0000; cout=0101 then temp=0000;cout=1; else temp=temp+1; cout=0; end if; end if; end if; en精品.d process; end a;6进制计数器仿真图:4、二十四进制计数器采用一个二进制的计数器和一个四进制的计数器相结合到一起,低位从0到9,到9向高位进一,当低位计到四,高位计到2,进行

8、进位输出,即每二十四个数进行一次进位输出library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity c24 isport(clr,start,clk:in std_logic;hour1,hour0:out std_logic_vector(3 downto 0);精品.end c24;architecture a of c24 isbegin process(clr,clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr=

9、1 then cnt0:=0000; cnt1:=0000;elsif clkevent and clk=1 thenif start=1 thenif cnt1=0010 and cnt0=0011then cnt1:=0000;cnt0:=0000;elsif cnt01001 then cnt0:=cnt0+1;else cnt0:=0000;cnt1:=cnt1+1;end if;end if;end if;hour1=cnt1;hour0=cnt0;end process;end a;精品.24进制计数器仿真图:5.数据选择和数码管选择模块代码:其功能是选择计数端口来的数据,当相应的

10、数据到来时数据选择器数据后输数给数码管,并由数码管显示。八个数码管分别显示小时,分钟,秒,百分秒library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity seltime isport(clk: in bit;dain0,dain1,dain2,dain3,dain4,dain5,dain6,dain7: in std_logic_vector(3 downto 0);sel: out std_logic_vector(2 downto 0);daout: out std_logic_vecto

11、r(3 downto 0);end seltime;精品.architecture a of seltime issignal temp:integer range 0 to 7;beginprocess(clk)beginif (clk=1and clkevent) thenif temp=7 then temp=0;else tempsel=000;daoutsel=001;daoutsel=010;daoutsel=011;daoutsel=100;daoutsel=101;daoutsel=110;daoutsel=111;daoutledledledledledledledledledledled=0000000;-00hend case;end process;end a;精品.五、秒表原理图精品.精品.六:实验总结通过本次的课程设计,我初步了解了vhdl语言的编程思想,以及利用eda软件进行电子电路设计的方法,通过对一个课题的分析,将实验的内容进行分块解读,具体到每一个模块的具体作用,然后将各个功能的模块通过连线进行总体的电路实现,也可以通过vhdl语言对各个模块进行组合,然后需要在程序编译成功的基础上,安装硬件,将程序下载到具体的芯片上进行硬件的实现。通过整个实

温馨提示

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

评论

0/150

提交评论