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

下载本文档

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

文档简介

1、课 程 设 计题 目 数字秒表设计 院 系 信息工程学院 班级 姓名 指导教师 - 12 -目录第1章 :系统设计要求.3第2章 :实验目的.3第3章 :实验原理.3第4章 :系统设计方案.3第5章 :主要VHDL源程序.4 1) 十进制计数器的VHDL源程序.42) 六进制计数器的VHDL源程序.5 3)蜂鸣器的VHDL源程序.5 4)译码器的VHDL源程序.65)控制选择器的VHDL源程序.76)元原件例化的VHDL源程序.8第六章:系统仿真.10第七章:系统扩展思路.11第八章:设计心得总结.11数字秒表的设计1、 系统设计要求 1.秒表共有6个输出显示,分别为百分之一秒、十分之一秒、秒

2、、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出,这样便于和显示译码器的连接。当计时达60分钟后,蜂鸣器鸣响10声。 2.整个秒表还需有一个启动信号和一个归零信号,以便秒表能随意停止及启动。 3.秒表的逻辑结构较简单,它主要由显示译码器、分频器、十进制计数器、六进制计数器和报警器组成。在整个秒表中最关键的是如何获得一个精确的100HZ计时脉冲。2、 实验目的通过本次课设,加深对EDA技术设计的理解,学会用Quartus工具软件设计基本电路,熟练掌握VHDL语言,为以后工作使用打下坚实的基础。3、 实验原理秒表由于其计时精确,分辨率高(0.01秒),在各种竞技场

3、所得到了广泛的应用。秒表的工作原理与数字时基本相同,唯一不同的是秒表的计时时钟信号,由于其分辨率为0.01秒,所以整个秒表的工作时钟是在100Hz的时钟信号下完成。当秒表的计时小于1个小时时,显示的格式是mm-ss-xx(mm表示分钟:059;ss表示秒:059;xx表示百分之一秒:099),当秒表的计时大于或等于一个小时时,显示的和多功能时钟是一样的,就是hh-mm-ss(hh表示小时:099),由于秒表的功能和钟表有所不同,所以秒表的hh表示的范围不是023,而是099,这也是和多功能时钟不一样的地方。在设计秒表的时候,时钟的选择为100Hz。变量的选择:因为xx(0.01秒)和hh(小时

4、)表示的范围都是099,所以用两个4位二进制码(BCD码)表示;而ss(秒钟)和mm(分钟)表示的范围是059,所以用一个3位的二进制码和一个4位的二进制码(BCD)码表示。显示的时候要注意的问题就是小时的判断,如果小时是00,则显示格式为mm-ss-xx,如果小时不为00,则显示hh-mm-ss。4、 系统设计方案秒表的逻辑结构较简单,它主要由显示译码器、分频器、十进制计数器、六进制计数器和报警器组成。四个10进制计数器:用来分别对百分之一秒、十分之一秒、秒和分进行计数;两个6进制计数器:用来分别对十秒和十分进行计数;分频器:用来产生100HZ计时脉冲;显示译码器:完成对显示的控制。 根据电

5、路持点,用层次设计概念将此设计任务分成若干模块,规定每一模块的功能和各模块之间的接口。按适配划分后的管脚定位,同相关功能块硬件电路接口连线。用VHDL语言描述所有底层模块。清零信号为异步清零。当最高位记到6时 停止计数 显示译码器全部显示零,并发出十声警报声。按下复位按钮后继续计数。数字秒表拟由单片的CPLD/FPGA来实现,经分析设计要求,拟定整个系统由10个模块组成,原理图如下:5、 主要VHDL源程序1. 十进制计数器的VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entit

6、y count10 isport (clk,start,clr : in std_logic;cout : out std_logic;daout : out std_logic_vector(3 downto 0);end count10;architecture one of count10 issignal q0 : std_logic_vector(3 downto 0);signal q1 : std_logic;beginprocess(clk,clr)beginif clr='1' then q0<="0000"elsif ( clk&#

7、39;event and clk='1') thenif start='1' then if q0="1001" then q0<="0000"q1<='1' else q0<=q0+1;q1<='0' end if;end if;end if;end process;daout<= q0;cout<=q1;end one;2. 六进制计数器的VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.

8、std_logic_unsigned.all;entity count6 isport (clk,start,clr : in std_logic;cout : out std_logic;daout : out std_logic_vector(3 downto 0);end count6;architecture two of count10 issignal q0 : std_logic_vector(3 downto 0);signal q1 : std_logic;beginprocess(clk,clr)beginif clr='1' then q0<=&qu

9、ot;0000"elsif ( clk'event and clk='1') thenif start='1' then if q0="0101" then q0<="0000"q1<='1' else q0<=q0+1;q1<='0' end if;end if;end if;end process;daout<= q0;cout<=q1;end two;3. 蜂鸣器的VHDL源程序library ieee;use ieee.std_l

10、ogic_1164.all;use ieee.std_logic_unsigned.all;entity alarm isport(clk,I:in std_logic; q:out std_logic );end alarm;architecture ar of alarm issignal n:integer range 0 to 20;signal q0:std_logic;beginprocess(clk)begin if clk'event and clk='1'thenif i='0' then q0<='0'n<

11、=0;elsif n<=19 and i='1' thenq0<=not q0;n<=n+1;else q0<='0'end if;end if;end process;q<=q0;end ar;4. 译码器的VHDL源程序library ieee; use ieee.std_logic_1164.all; entity deled is port(num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0); end deled ; archit

12、ecture a of deled is begin process(num) begin case num is when"0000"=>led<="0111111" when"0001"=>led<="0000110" when"0010"=>led<="1011011" when"0011"=>led<="1001111" when"0100"=>led&l

13、t;="1100110" when"0101"=>led<="1101101" when"0110"=>led<="1111101" when"0111"=>led<="0100111" when"1000"=>led<="1111111" when"1001"=>led<="1101111" when others=

14、>led<="0000000" end case; end process; end a;5. 控制选择器的VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity seltime isport(clr,clk: in bit; dain0,dain1,dain2,dain3,dain4,dain5: in std_logic_vector(3 downto 0); sel: out std_logic_vector(2 downto 0); da

15、out: out std_logic_vector(3 downto 0);end seltime;architecture a of seltime is signal temp:integer range 0 to 5;begin process(clk) begin if (clr='1') then daout<="0000" sel<="000" temp<=0; elsif (clk='1'and clk'event) then if temp=5 then temp<=0; e

16、lse temp<=temp + 1; end if; case temp is when 0=>sel<="000"daout<=dain0; when 1=>sel<="001"daout<=dain1; when 2=>sel<="010"daout<=dain2; when 3=>sel<="011"daout<=dain3; when 4=>sel<="100"daout<=dain4; w

17、hen 5=>sel<="101"daout<=dain5; end case; end if; end process;end a;6. 分频器的VHDL源程序library ieee;use ieee.std_logic_1164.all;entity div isport(clr,clk: in std_logic; q: buffer std_logic);end div;architecture a of div is signal count:integer range 0 to 99999; beginprocess(clr,clk)begi

18、nif (clk'event and clk='1') thenif clr='1' thencount<=0;elsif count=99999 thencount<=0;q<= not q;elsecount<=count+1;end if;end if;end process;end a;7. 元原件例化的VHDL源程序library ieee;use ieee.std_logic_1164.all;entity mb_top isport ( stop,start,clk:in std_logic; a,b,c,d,e,f

19、,g,speaker:out std_logic; sel:out std_logic_vector(2 downto 0);end mb_top;architecture a of mb_top iscomponent divport(clr,clk: in std_logic; q: buffer std_logic);end component;component count10port( clr,start,clk:in std_logic; cout:out std_logic; daout:buffer std_logic_vector(3 downto 0);end compon

20、ent;component count6 port( clr,start,clk:in std_logic; cout:out std_logic; daout:buffer std_logic_vector(3 downto 0);end component;component seltimeport( clr,clk:in std_logic; dain1:in std_logic_vector(3 downto 0); dain2:in std_logic_vector(3 downto 0); dain3:in std_logic_vector(3 downto 0); dain4:i

21、n std_logic_vector(3 downto 0); dain5:in std_logic_vector(3 downto 0); dain6:in std_logic_vector(3 downto 0); sel:out std_logic_vector(2 downto 0); daout:out std_logic_vector(3 downto 0);end component;component deledport( num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0);end

22、component;component alarmport( clk,i:in std_logic; q:out std_logic);end component;signal div_q,b_cout,s_cout,m_cout,sm_cout,f_cout,sf_cout:std_logic;signal b_daout,s_daout,m_daout,sm_daout,f_daout,sf_daout,seltime_daout:std_logic_vector(3 downto 0);signal ledout:std_logic_vector(6 downto 0);begina&l

23、t;=ledout(0);b<=ledout(1);c<=ledout(2);d<=ledout(3);e<=ledout(4);f<=ledout(5);g<=ledout(6);u1:div port map(stop,clk,div_q);u2:count10 port map(stop,start,div_q,b_cout,b_daout);u3:count10 port map(stop,start,b_cout,s_cout,s_daout);u4:count10 port map(stop,start,s_cout,m_cout,m_daout

24、);u5:count6 port map(stop,start,m_cout,sm_cout,sm_daout);u6:count10 port map(stop,start,sm_cout,f_cout,f_daout);u7:count6 port map(stop,start,f_cout,sf_cout,sf_daout);u8:seltime port map(stop,div_q,b_daout,s_daout,m_daout,sm_daout,f_daout,sf_daout,sel,seltime_daout);u9:deled port map(seltime_daout,ledout);u10:alarm port map(div_q,sf_cout,speaker);end a;6、 系统仿真1. 十进制2. 六进制3. 蜂鸣器4. 译码器5. 控制选择器7、 系统扩展思路根据实验的内容可以适当的添加一些有实际作用和可行性的功能,如可以记录并显示多个数据。根据扩展的内容设计相应的电路和模块来完成扩展的内容。比如记录和显示多个数据,可以用多个秒表进行计数,在秒表电路的后面可以添加

温馨提示

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

评论

0/150

提交评论