- 40
- 0
- 约2.3千字
- 约 3页
- 2017-06-13 发布于四川
- 举报
实验二 含异步清零和同步使能的加法计数器
并用数码管显示
一、 实验目的
1、 了解二进制计数器的工作原理。
2、 进一步熟悉 QUARTUSII 软件的使用方法和 VHDL 输入。
3、时钟在编程过程中的作用。
二、 实验内容
本实验要求完成的任务是在时钟信号的作用下,通过使能端和复位信号来完
成加法计数器的计数。实验中时钟信号使用数字时钟源模块的 1HZ 信号,用一位en表示使能端信号,用复位开关 rest 表示复位信号,用 LED 模块的LED1~LED7 来表示计数的二进制结果。实验 LED亮表示对应的位为‘1’ LED
灭表示对应的位为‘0’ 。通过输入不同的值模拟计数器的工作时序,观察计数的结果。实验箱中的拨动开关、与 FPGA 的接口电路,LED 灯与 FPGA 的接口电路以及拨动开关、 LED 与FPGA的管脚连接在实验一中都做了详细说明, 这里不在赘述。
三 实验步骤
1、 打开 QUARTUSII 软件,新建一个工程。
2、 建完工程之后,再新建一个 VHDL File,打开 VHDL 编辑器对话框。
3、在 VHDL 编辑窗口编写 VHDL 程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity exp4 is
port( clk ,clr,en : in std_logic;
co:out std_logic;
key : in std_logic_vector(3 downto 0);
ledag : out std_logic_vector(6 downto 0);
del : out std_logic_vector(3 downto 0)
);
end exp4;
architecture whbkrc of exp4 is
signal dount : std_logic_vector(3 downto 0);
begin
process(clk)
begin
if clkevent and clk=1 then
if clr=1then
dount=(others=0);
elsif en=1then
if key=1111then
dount=0000;
co=1;
else
dount=dount+1;
co=0;
end if;
end if;
end if;
del=dount;
end process;
process(key)
begin
case key is
when 0000 = ledag =0111111;
when 0001 = ledag =0000110;
when 0010 = ledag =1011011;
when 0011 = ledag =1001111;
when 0100 = ledag =1100110;
when 0101 = ledag =1101101;
when 0110 = ledag =1111101;
when 0111 = ledag =0000111;
when 1000 = ledag =1111111;
when 1001 = ledag =1101111;
when 1010 = ledag =1110111;
when 1011 = ledag =1111100;
when 1100 = ledag =0111001;
when 1101 = ledag =1
您可能关注的文档
- 吉安五中2011-2012年下学期八年级第二次月考语文试卷3.doc
- 和力公司建设项目可研报告.doc
- 精品解析:北京市海淀区2025-2026学年九年级上学期期末语文试题(原卷版).docx
- 精品解析:北京市东城区汇文中学2025-2026学年八年级上学期期中语文试题(解析版).docx
- 通航建筑物运行管理办法2026修订版课件.pptx
- 政府投资基金投向评价管理办法(试行).pptx
- 新能源汽车废旧动力电池回收和综合利用管理暂行办法课件.pptx
- 机械有限公司职业卫生管理制度全套及操作规程.doc
- 黑龙江省行政能力测试真题及答案解析.doc
- 陕西省安全员A证考核试题.docx
- 浙江省温州市2024-2025学年七年级上学期语文期末考查卷.docx
- 精品解析:北京市建华实验学校2024-2025学年七年级下学期期中英语试题(原卷版).docx
- 精品解析:北京市通州区2024-2025学年七年级下学期期末考试英语试卷(原卷版).docx
- 精品解析:北京市回民学校2024-2025学年九年级上学期期中语文试题(解析版).docx
- 精品解析:北京市海淀区2025-2026学年九年级上学期期末语文试题(解析版).docx
- 精品解析:北京市东城区汇文中学2025-2026学年八年级上学期期中语文试题(原卷版).docx
- 精品解析:北京市回民学校2024-2025学年九年级上学期期中语文试题(原卷版).docx
- 精品解析:2024-2025学年广东省广州市从化区街口镇中心小学人教版五年级上册期中测试数学试卷(解析版).docx
- 精品解析:北京市通州区2024-2025学年七年级下学期期末考试英语试卷(解析版).docx
- 精品解析:北京市建华实验学校2024-2025学年七年级下学期期中英语试题(解析版).docx
原创力文档

文档评论(0)