实验三 数码管静态显示设计
1.实验要求
利用VHDL设计一数码管静态显示程序并仿真,再利用实验箱进行效果检验,使在脉冲的作用下数码管从0到7循环显示。
2.实验目的
了解数码管静态显示的原理,学会设计需要用到的一些基本芯片。
3.设计方案分析
此功能实现可用一八进制计数器和一显示译码器组成。在1Hz 脉
冲的作用下计数器循环计数,每次计数后,显示译码器都会进行译码输出,输出结果接到数码管让其显示。
4.程序设计 library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity sample is
port(clk,rst,en:in std_logic; count:out std_logic;
y:out std_logic_vector(7 downto 0)); end sample;
architecture one of sample is
signal cq:std_logic_vector(2 downto 0); begin
process(clk,rst) begin
if rst='1' then cq<=\
elsif clk'event and clk='1' then if en='1' then cq<=cq+'1'; else cq<=cq;
end if; end if; end process; process(cq) begin
if cq=\ else count<='0'; end if;
end process; process(cq) begin case cq is
when \ when \ when \ when \ when \ when \ when \ when \ end case; end process; end one;
5.仿真结果
实验四
数码管动态显示设计
1.实验要求
利用VHDL设计一数码管动态显示程序并仿真,再利用实验箱进行效果检验,使数码管从左往右依次显示1~8。
2.实验目的
了解数码管动态显示的原理,学会设计需要用到的一些基本芯片。
3.设计方案分析
此功能实现仍可用一八进制计数器和一显示译码器组成。但比起
静态显示时需要考虑数码管的位选端,所以需要在程序中多一输出量。
4.程序设计
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity sample2 is
port(clk,rst,en:in std_logic; count:out std_logic;
y:out std_logic_vector(7 downto 0); wela:out std_logic_vector(2 downto 0)); end sample2;
architecture one of sample2 is
signal cq:std_logic_vector(2 downto 0); begin
process(clk,rst) begin
if rst='1' then cq<=\elsif clk'event and clk='1' then if en='1' then cq<=cq+'1'; else cq<=cq;
end if; end if;
end process; process(cq) begin
if cq=\ else count<='0'; end if; end process; process(cq) begin case cq is
when \ wela<=\when \ wela<=\when \ wela<=\when \ wela<=\when \ wela<=\when \ wela<=\when \ wela<=\when \ wela<=\end case; end process; end one;
5.仿真结果
6.实验结果图