人人范文网 范文大全

FPGA秒表实验报告

发布时间:2020-03-03 01:21:43 来源:范文大全 收藏本文 下载本文 手机版

课程设计报告

专业班级 课 程 题 目 秒表的设计 学 号 姓 名 同 组 人 成 绩

2013年5月

一、设计目的

1.进一步熟悉七段码译码器的硬件接口。 2.掌握用扫描方法驱动多个数码管硬件接口。 3.掌握秒表VHDL的编程方法 。

二、系统总体设计 (1).设计要求:

1.秒表共有6个输出显示,分别为百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出,这样便于和显示译码器的连接。当计时达60分钟后,蜂鸣器鸣响10声。

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

(2).实验原理: 秒表由于其计时精确,分辨率高(0.01秒),在各种竞技场所得到了广泛的应用。秒表的工作原理与数字时基本相同,唯一不同的是秒表的计时时钟信号,由于其分辨率为0.01秒,所以整个秒表的工作时钟是在100Hz的时钟信号下完成。当秒表的计时小于1个小时时,显示的格式是mm--xx(mm表示分钟:0~59;表示秒:0~59;xx表示百分之一秒:0~99),当秒表的计时大于或等于一个小时时,显示的和多功能时钟是一样的,就是hh-mm-(hh表示小时:0~99),由于秒表的功能和钟表有所不同,所以秒表的hh表示的范围不是0~23,而是0~99,这也是和多功能时钟不一样的地方。在设计秒表的时候,时钟的选择为100Hz。变量的选择:因为xx(0.01秒)和hh(小时)表示的范围都是0~99,所以用两个4位二进制码(BCD码)表示;而(秒钟)和mm(分钟)表示的范围是0~59,所以用一个3位的二进制码和一个4位的二进制码(BCD)码表示。显示的时候要注意的问题就是小时的判断,如果小时是00,则显示格式为mm--xx,如果小时不为00,则显示hh-mm-。

三、详细设计

1.计时模块:计时模块执行计时功能,计时方法和计算机一样是对标准时钟脉冲计数。他是由四个十进制计数器和俩个六进制计数器构成,其中毫秒位、十毫秒位、秒位和分位采用十进制计数器,十秒位和十分位采用六进制计数器。

COUNT10CLKSTARTCLRCOUTDAOUT[3..0]源程序:inst2

(1)十进制计数器(count_10) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;

entity COUNT10 is port (CLK,START,CLR : in std_logic;

COUT : out std_logic;

DAOUT : out std_logic_vector(3 downto 0)); end COUNT10; architecture one of COUNT10 is signal h0 : std_logic_vector(3 downto 0); signal h1 : std_logic; begin proce(CLK,CLR) begin if CLR=\'1\' then h0

if START=\'1\' then

if h0=\"1001\" then

h0

h1

else h0

h1

end if;

end if;

end if; end proce; DAOUT

(2)六进制计数器(count_6)

COUNT6CLKSTARTCLRinst1COUTDAOUT[3..0]

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity COUNT6 is port (CLK,START,CLR : in std_logic;

COUT : out std_logic;

DAOUT: out std_logic_vector(3 downto 0)); end COUNT6; architecture two of COUNT6 is signal h0 : std_logic_vector(3 downto 0); signal h1 : std_logic; begin proce(CLK,CLR) begin if CLR=\'1\' then h0

if START=\'1\' then

if h0=\"0101\" then

h0

h1

else h0

h1

end if;

end if;

end if; end proce; DAOUT

2.计时显示器(deled)

计时显示电路的作用是将计时值在LED数码管上显示出来。计时电路产生的值经过BCD七段译码后,驱动LED数码管。计时显示电路的实现方案采用扫描显示。部分源程序:

delednum[3..0]led[6..0]inst3

Library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.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 proce(num) begin case num is when\"0000\"=>ledledledledledledledledledledled

3.分频

fenpinclrclkqinst4

library ieee; use ieee.std_logic_1164.all;

entity fenpin is

port(clr,clk: in std_logic;q: buffer std_logic); end fenpin; architecture b of fenpin is

signal counter:integer range 0 to 49999; begin

proce(clr,clk)

begin

if (clk=\'1\' and clk\'event) then

if clr=\'1\' then

counter

elsif counter=49999 then

counter

q

else

counter

end if;

end if;

end proce; end b;

4.位选

seltimeclkclrdain0[3..0]dain1[3..0]dain2[3..0]dain3[3..0]dain4[3..0]dain5[3..0]daout[3..0]sel[2..0]inst5 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;

entity seltime is port (

clk:in std_logic;

clr:in std_logic;

dain0:in std_logic_vector(3 downto 0);

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:in std_logic_vector(3 downto 0);

dain5:in std_logic_vector(3 downto 0);

daout:buffer std_logic_vector(3 downto 0);

sel:buffer std_logic_vector(2 downto 0)); end seltime; architecture three of seltime is signal m:std_logic_vector(2 downto 0); signal n:std_logic_vector(3 downto 0); begin n

dain0 when m=\"000\" else dain1 when m=\"001\"else dain2 when m=\"010\"else dain3 when m=\"011\"else dain4 when m=\"100\" else dain5; proce(clr,clk,dain0,dain1,dain2,dain3,dain4,dain5) begin if clk \'event and clk=\'1\'then if m=\"101\" then m

5.警告

ALARMCLKdainqinst

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity ALARM is port (CLK: in std_logic;

dain: in std_logic;

q: out std_logic); end ALARM; architecture four of ALARM is signal count: std_logic_vector(1 downto 0); begin proce(clk) begin q

if(dain=\'1\')then

if(count=\"10\")then

count

else

count

end if;

end if;

end if;

end proce;

q

四、仿真分析 1.仿真结果:

2.管脚分配:

五.设计中遇到的问题及解决方法

问题:

1.对秒表设计的原理理解不到位,试验不能正常进行。 2.因为程序输入不正确,导致程序编译不成功。

3.管脚分配不合理,导致结果不能显示或者不能正常显示。 解决方法:

1.进一步理解实验的原理,各部分的组成以及功能。 2.运行程序之前仔细检查程序,并适当注释。 3.按照规定分配管脚,注意区别不能定义的管脚。

六.心得体会:

因为对EDA技术及Quartus软件的相关知识知道的不够深入,在设计过程

中我们遇到了很多困难,但通过从网上找一些相关资料,最终完成了设计任务。 开始做设计时总是会出现各种错误,经过不停的编译及改错最终得到了正确的程序。其实这些错误的主要原因是自己的粗心造成的,如果细心一些这些错误时可以避免的。在编程时,要使用层次化结构的思想,这样程序检查起来也比较方便,调试时也给了自己很大的方便,只要一个模块一个模块的进行调就可以了,充分体现了结构化编程的优势。在设计中要求我们要有耐心和毅力,还要细心,稍有不慎,一个小小的错误就会导致结果的不正确,而对错误的检查要求我们要有足够的耐心,通过这次设计和设计中遇到的问题,也积累了一定的经验,对以后从事集成电路设计工作会有一定的帮助。

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

FPGA实验报告

FPGA交通灯实验报告

FPGA可调数字时钟实验报告

FPGA实验报告北航电气技术实验

电子秒表设计任务书

FPGAverilog秒表设计

FPGA学习心得

FPGA学习心得

FPGA教学大纲

单片机课程设计之秒表

FPGA秒表实验报告
《FPGA秒表实验报告.doc》
将本文的Word文档下载到电脑,方便编辑。
推荐度:
点击下载文档
点击下载本文文档