打印
[Quartus]

问一个七段显示译码器小数点的问题

[复制链接]
1656|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
怎样修改程序能完成小数点的显示,例如123.4,希望给点提示吧
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY SCAN_LED IS                                    
    PORT (   CLK   : IN STD_LOGIC;
      d0,d1,d2,d3,d4,d5,d6,d7:in STD_LOGIC_VECTOR(3 DOWNTO 0);
      SG   : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
      BT   : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) );
END;
ARCHITECTURE one OF SCAN_LED IS
    SIGNAL CNT8  : STD_LOGIC_VECTOR(2 DOWNTO 0);
    SIGNAL    A  : STD_LOGIC_VECTOR(3 DOWNTO 0);
BEGIN
P1:PROCESS( CNT8 )
    BEGIN
        CASE  CNT8  IS
          WHEN "000" =>  BT <= "00000001" ; A <= d0 ;
          WHEN "001" =>  BT <= "00000010" ; A <= d1 ;
          WHEN "010" =>  BT <= "00000100" ; A <= d2;
          WHEN "011" =>  BT <= "00001000" ; A <= d3 ;
          WHEN "100" =>  BT <= "00010000" ; A <= d4;
          WHEN "101" =>  BT <= "00100000" ; A <= d5;
          WHEN "110" =>  BT <= "01000000" ; A <= d6;
          WHEN "111" =>  BT <= "10000000" ; A <= d7 ;
          WHEN OTHERS =>  NULL ;
        END CASE ;
     END PROCESS P1;
    P2:PROCESS(CLK)
        BEGIN
         IF CLK'EVENT AND CLK = '1'
          THEN CNT8 <= CNT8 + 1;   
         END IF;
           END PROCESS P2 ;   
         P3:PROCESS( A )
BEGIN
       CASE  A  IS
        WHEN "0000"=> SG <= "0111111";  WHEN "0001" => SG <= "0000110";
        WHEN "0010" => SG <= "1011011";  WHEN "0011" => SG <= "1001111";
        WHEN "0100" => SG <= "1100110";  WHEN "0101" => SG <= "1101101";
        WHEN "0110" => SG <= "1111101";  WHEN "0111"  => SG <= "0000111";
        WHEN "1000"=> SG <= "1111111";  WHEN "1001"=> SG <= "1101111";
        WHEN "1010"=> SG <= "1110111";  WHEN "1011"=> SG <= "1111100";
        WHEN "1100"=> SG <= "0111001";  WHEN "1101"=> SG <= "1011110";
        WHEN "1110"=> SG <= "1111001";  WHEN "1111" => SG <= "1110001";
        WHEN OTHERS =>  NULL ;
       END CASE ;
      END PROCESS P3;   
    END;

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝