文档详情

项目四秒表设计实验报告精选.doc

发布:2017-06-08约2.42千字共5页下载文档
文本预览下载声明
“项目四 秒表设计”实验报告 专业班级: 电子144 姓名: 秦慧桦 学号: 2014014273 实验日期: 2016.10.13 一、实验目的 熟悉并掌握计数器的设计; 熟悉数码管的设计; 熟悉VHDL语言的分层次设计; 二实验内容: 1)对50MHz晶振进行500000分频,得到100Hz信号; 2)对该100Hz信号进行0-9的循环计数,并用一位数码管显示; 3)在2成功的基础上进行扩展,实现100Hz信号的0-99循环计数,并用两位数码管进行显示; 4)扩展内容:计数初值可以设置,计数值可以人为干预; 三、实验结果 1. 对50MHz晶振进行500000分频,得到100Hz信号的程序代码 library ieee; use ieee.std_logic_1164.All; use ieee.std_logic_unsigned.All; use ieee.std_logic_arith.All; entity div25 is port(clkin:in std_logic; clkout:buffer std_logic); end; architecture ret1 of div25 is begin process(clkin) variable count:integer range 0 to 249999; begin if clkin event and clkin=1 then if count249999 then count:=count+1; else count:=0;clkout=not clkout; end if; end if; end process; end; 2.对100Hz信号的0-99循环计数程序代码及仿真结果 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity cnt99 is port (clkout:in std_logic; gw:out std_logic_vector(3 downto 0); sw:out std_logic_vector(3 downto 0)); end; architecture rtl of cnt99 is begin process(clkout) variable num:std_logic_vector (3 downto 0) ; variable s:std_logic_vector (3 downto 0) ; begin if clkout event and clkout=1 then if (num9) then num:=num+1; else num:=0000;s:=s+1; if (s9) then s:=0000; end if; end if ; end if; gw=num; sw=s; end process; end ; 3 顶层文件的截屏、引脚锁定及实验现象截图,并对实验现象进行分析 实验现象分析:单片机数码管显示从0~99秒的计时。 如何实现秒表的倒计时功能?请给出程序及实验结果。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity cntd99 is port (clkout:in std_logic; gw:out std_logic_vector(3 downto 0); sw:out std_logic_vector(3 downto 0)); end; architecture rtl of cntd99 is begin process(clkout) variable num:std_logic_vector (3 downto 0) ; variable s:std_logic_vector (3 downto 0) ; begin if clkout event and clkout=1 then if (num9) th
显示全部
相似文档