- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi guys i'm having a bit of a problem trying to figure out how to represent binary numbers up to 99 in 2 seven segments.
i have my decoder code
library ieee;
use ieee.std_logic_1164.all;
entity Decodificador is
port(
bcd: in std_logic_vector(3 downto 0);
led: out std_logic_vector(6 downto 0)
);
end Decodificador;
architecture rtl of Decodificador is
begin
process (bcd)
begin
case bcd is
when "0000" => LED <= "1111110";
when "0001" => LED <= "1100000";
when "0010" => LED <= "1011011";
when "0011" => LED <= "1110011";
when "0100" => LED <= "1100101";
when "0101" => LED <= "0110111";
when "0110" => LED <= "0111111";
when "0111" => LED <= "1100010";
when "1000" => LED <= "1111111";
when "1001" => LED <= "1110111";
when others => LED <= "0000000";
end case;
end process;
end rtl;
still it will get up to 9, is there any form to represent the numbers up to 99 without having to declare 99 cases? thank you.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, use your grey cells, you are halfway there : divide and conquer
A tip: think of re-use of module/code- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you first have to convert a binary natural number into BCD and then instance two times decodificador, one for the units digit and one for the tens.
Remember that 33 in decimal needs 8 bit in BCD (0011 0011) so your convertion module is charge to generate BCD code for units and BCD code for tens. for example: process(...) ....... if(bin>=10 and bin<20) then bcd_tens<="0001" ........ for the units i think you should be able to drive the related decodificator with (bin mod 10) that should be the BCD units by itself.....- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you memes for your help, as you said had to convert it to bcd, now i made it, thank you guys

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page