数字秒表设计VHDL

更新时间:2023-03-20 12:42:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

数字秒表设计

北 华 航 天 工 业 学 院

《EDA技术综合设计》

课程设计报告

报告题目: 数字秒表设计 作者所在系部: 电子工程系 作者所在专业: 电子信息工程 作者所在班级: 作 者 姓 名 : 指导教师姓名:完 成 时 间 : 2010年12月12日

数字秒表设计

内 容 摘 要

应用VHDL语言设计数字系统,很多设计工作可以在计算机上完成,从而缩短了数字系统的开发时间。我们尝试利用VHDL为开发工具设计数字秒表。

秒表的逻辑结构较简单,它主要由十进制计数器、六进制计数器、12500的分频器、数据选择器、和显示译码器等组成。在整个秒表中最关键的是如何获得一个精确的100HZ计时脉冲,除此之外,整个秒表还需有一个启动信号和一个清零信号,以便秒表能随意停止及启动。

秒表有共有6个输出显示,分别为百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出,这样便与同显示译码器连接。开关设置秒表报警器,每10秒钟,蜂鸣器鸣响1声,发光二极管闪烁。当计时达60分钟后,蜂鸣器鸣响10声。

关键词:VHDL、数据选择器、计数器、显示器

数字秒表设计

目 录

一、 系统组成框图……………………………………………………5

二、 各模块原理及其程序……………………………………………5 1、 六进制计数器……………………………………………………6 2、 十进制计数器 …………………………………………………6 3、 蜂鸣器 ………………………………………………………7 4、 译码器…………………………………………………………8 5、 控制器…………………………………………………………9 三、 系统仿真 ………………………………………………………10 1、 六进制计数器 …………………………………………………10 2、 十进制计数器 …………………………………………………10 3、 蜂鸣器 ………………………………………………………10 4、 译码器 ………………………………………………………10 5、 控制器 ………………………………………………………10

四、心得体会 ……………………………………………………11

数字秒表设计

课程设计任务书

数字秒表设计

设计过程

系统组成框图

二.各模块及的原理及其程序

(1)六进制计数器

数字秒表设计

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count6 is

port (clk,clr,start:in std_logic;

daout:out std_logic_vector(3 downto 0); cout:out std_logic ); end count6;

architecture behave of count6 is signal temp:std_logic_vector(3 downto 0); begin process(clk,clr) begin

if clr='1' then temp<="0000"; cout<='0';

elsif clk'event and clk='1' then if start='1'then

if temp>="0101" then temp<="0000"; cout<='1';

else temp<=temp+1; cout<='0'; end if; end if; end if; end process; daout<=temp; end behave; (2)十进制计数器

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity count10 is port(

clr,start,clk:in std_logic;

cout:out std_logic;

数字秒表设计

daout:buffer std_logic_vector(3 downto 0)); end count10;

architecture behave of count10 is begin

process(clr,start,clk) begin

if clr='1' then daout<="0000"; elsif ( clk'event and clk='1') then if start='1' then

if daout="1001" then daout<="0000";cout<='1'; else daout<=daout+1;cout<='0'; end if; end if; end if; end process; end behave;

(3)蜂鸣器 library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity alarm is port(clk,I:in std_logic; q:out std_logic ); end alarm;

architecture ar of alarm is signal n:integer range 0 to 20; signal q0:std_logic; begin process(clk) begin

if clk'event and clk='1' then

if i='0' then q0<='0';

n<=0;

数字秒表设计

elsif n<=19 and i='1' then q0<=not q0; n<=n+1; else q0<='0'; end if; end if; end process; q<=q0; end ar; (4)译码器 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 ;

architecture 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<="1100110"; when"0101"=>led<="1101101"; when"0110"=>led<="1111101"; when"0111"=>led<="0100111"; when"1000"=>led<="1111111"; when"1001"=>led<="1101111"; when others=>led<="0000000"; end case; end process;

end a;

数字秒表设计

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity seltime is port(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); daout: 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; else 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; when 5=>sel<="101";daout<=dain5; end case; end if; end process; end a;

三.系统仿真

数字秒表设计

(2)十进制

(3)蜂鸣器

(4)译码器

(5)控制器

数字秒表设计

四.心得体会

开始做设计时总是会犯一些错误,只有经过不停的改错不停的编译才能得到正确的程序。在编程时,我充分使用了结构化的思想,这样程序检查起来也比较方便,调试时也给了我很大方便,只要一个模块一个模块的进行调就可以了,充分体现了结构化编程的优势。在设计中要求我要有耐心和毅力,还要细心,稍有不慎,一个小小的错误就会导致结果的不正确,而对错误的检查要求我要有足够的耐心,通过这次设计和设计中遇到的问题,也积累了一定的经验,对以后从事集成电路设计工作会有一定的帮助。

在应用VHDL的过程中让我真正领会到了其并行运行与其他软件顺序执行的差别及其在电路设计上的优越性。用VHDL硬件描述语言的形式来进行数字系统的设计方便灵活,利用EDA软件进行编译优化仿真极大地减少了电路设计时间和可能发生的错误,降低了开发成本,这种设计方法在数字系统设计中发挥越来越重要的作用。

数字秒表设计

教 师评 语及 设计 成绩

课程设计成绩:

指导教师:

日期:

- - 12 - -

本文来源:https://www.bwwdw.com/article/0041.html

Top