当前位置:   article > 正文

十进制计数器和BCD七段译码数码管显示的VHDL实现_七段数码管十进制显示器

七段数码管十进制显示器

十进制计数器和BCD七段译码数码管显示的VHDL实现

library ieee;
use ieee.std_logic_1164.all;
entity counter is
port
(
	a:in std_logic_vector(3 downto 0);
	hex:out std_logic_vector(6 downto 0)
);
end counter;

architecture one of counter is
begin
	process(a)
	begin
		 case a is
			 when "0000"=>hex<="1000000";
			 when "0001"=>hex<="1111001";
			 when "0010"=>hex<="0100100";
			 when "0011"=>hex<="0110000";
			 when "0100"=>hex<="0011001";
			 when "0101"=>hex<="0010010";
			 when "0110"=>hex<="0000010";
			 when "0111"=>hex<="1111000";
			 when "1000"=>hex<="0000000";
			 when "1001"=>hex<="0010000";
			 when others=>hex<="1111111";
		 end case;
	end process;
end ;
library ieee;

use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter is
	port
	(
		clk,res,set: in std_logic;
		d:in std_logic_vector(3 downto 0);
		q: out std_logic_vector(6 downto 0);
                    cout:out std_logic
	);
end counter;

architecture one of counter is
	component display 
	port 
	( 
                a:in std_logic_vector(3 downto 0);
                hex:out std_logic_vector(6 downto 0)
  	);
	end component;	
	signal temp:std_logic_vector(3 downto 0);	
begin	
inst1 : display port map 
                   (
		a => temp,
		hex => q
	          );	
	process(clk,res,set) 
	begin 
	if (res='0') then
	temp<="0000";
	elsif(clk'event and clk='1') then	
	 if(set='0') then
	 temp<=d;
	 elsif
       temp="1001"then
		temp<="0000";
		else
       temp<=temp+1;		
	end if;	
    end if;
  end process;
cout<='1'when temp="1001"else'0';
end ;

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/679609
推荐阅读
相关标签
  

闽ICP备14008679号