I was able to successfully a hexadecimal counter on one of the four seven segment displays (Select to display on one of them). I can't seem to understand how to display a decimal point. My code is attached below. I want to display a decimal point in front of or before one of the signed four-bit numbers to demonstrate a negative.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity main_signed4bitnumbers is
Port ( Seg : out STD_LOGIC_VECTOR (7 downto 0);
Din : inout STD_LOGIC_VECTOR (3 downto 0);
Sel : inout STD_LOGIC_VECTOR (1 downto 0);
AN : inout STD_LOGIC_VECTOR (3 downto 0)
);
end main_signed4bitnumbers;
architecture Behavioral of main_signed4bitnumbers is
begin
procselect: process(Sel)
begin
if (Sel = "00") then AN <= "0111";
elsif (Sel <= "01") then AN <= "1011";
elsif (Sel <= "10") then AN <= "1101";
elsif (Sel <= "11") then AN <= "1110";
end if;
end process procselect;
myproc1:process(Din)
begin
case Din is
when "0000" => Seg <= "1000000"; -- '+0'
when "0001" => Seg <= "1111001"; -- '+1'
when "0010" => Seg <= "0100100"; -- '+2'
when "0011" => Seg <= "0110000"; -- '+3'
when "0100" => Seg <= "0011001"; -- '+4'
when "0101" => Seg <= "0010010"; -- '+5'
when "0110" => Seg <= "0000010"; -- '+6'
when "0111" => Seg <= "1111000"; -- '+7'
when "1000" => Seg <= "1000000"; -- '-0'
when "1001" => Seg <= "1111001"; -- '-1'
when "1010" => Seg <= "0100100"; -- '-2'
when "1011" => Seg <= "0110000"; -- '-3'
when "1100" => Seg <= "0011001"; -- '-4'
when "1101" => Seg <= "0010010"; -- '-5'
when "1110" => Seg <= "0000010"; -- '-6'
when "1111" => Seg <= "1111000"; -- '-7'
when others => Seg <= "1111111"; -- 'nothing'
end case;
end process myproc1;
end Behavioral;
Question
vizia
I was able to successfully a hexadecimal counter on one of the four seven segment displays (Select to display on one of them). I can't seem to understand how to display a decimal point. My code is attached below. I want to display a decimal point in front of or before one of the signed four-bit numbers to demonstrate a negative.
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.