📄 segment_scan_clock_24.vhd
字号:
--*******************************************
--* CLOCK (24 Hour) And Display In *
--* Scanning Seven Segment LED (6DIG) *
--* Filename : SEGMENT_SCAN_CLOCK_24.VHD *
--*******************************************
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.CLOCK_PACK.all;
entity SEGMENT_SCAN_CLOCK_24 is
Port ( CLK : in std_logic;
RESET : in std_logic;
ENABLE : out std_logic_vector(6 downto 1);
SEGMENT : out std_logic_vector(7 downto 0));
end SEGMENT_SCAN_CLOCK_24;
architecture Behavioral of SEGMENT_SCAN_CLOCK_24 is
signal SCAN_CLK : std_logic;
signal CLOCK : std_logic;
signal CARRY_SEC : std_logic;
signal CARRY_MIN : std_logic;
signal TIME_BCD : std_logic_vector(23 downto 0);
signal DECODER_BCD : std_logic_vector(3 downto 0);
signal POSITION : std_logic_vector(6 downto 1);
begin
--********************************************
--* Decide Seven Segment's Display Location *
--********************************************
process (SCAN_CLK,RESET)
begin
if RESET = '0' then
POSITION <= "111110";
elsif SCAN_CLK'event and SCAN_CLK = '1' then
POSITION <= POSITION(5 downto 1) & POSITION (6);
end if;
end process;
ENABLE <= POSITION;
--*****************************************
--* Decide Seven Segment's Display Data *
--*****************************************
process (POSITION,TIME_BCD)
begin
case POSITION is
when "111110" => DECODER_BCD <= TIME_BCD(3 downto 0);
when "111101" => DECODER_BCD <= TIME_BCD(7 downto 4);
when "111011" => DECODER_BCD <= TIME_BCD(11 downto 8);
when "110111" => DECODER_BCD <= TIME_BCD(15 downto 12);
when "101111" => DECODER_BCD <= TIME_BCD(19 downto 16);
when "011111" => DECODER_BCD <= TIME_BCD(23 downto 20);
when others => null;
end case;
end process;
TIME_BASE : CLK_SET port map (CLK,RESET,SCAN_CLK,CLOCK);
SECOND : COUNT_00_59 port map (CLOCK,RESET,'1' ,CARRY_SEC,TIME_BCD(7 downto 0));
MINUTE : COUNT_00_59 port map (CLOCK,RESET,CARRY_SEC,CARRY_MIN,TIME_BCD(15 downto 8));
HOUR : COUNT_00_23 port map (CLOCK,RESET ,CARRY_MIN,TIME_BCD(23 downto 16));
DECODER : DECODER port map (CLOCK,DECODER_BCD,SEGMENT);
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -