vhdl seven segment--please help

Thread Starter

marwa

Joined Jan 6, 2008
3
how can i display an integer number on the seven segment ??

i know how to display the number if it ranges from 0 to 9 using one segment

but i'm having a little trouble with displaying numbers from 0 to 9999 using 4 segments ????

i need to know this; but i have little clue i would appreciate any help!!
 

Papabravo

Joined Feb 24, 2006
21,228
Ah...you need to convert the binary integer into decimal digits. For example if you have an 8 bit integer you can convert that to three decimal digits. If you have a 16-bit integer you can convert that to 5 decimal digits.

The standard technique is the repeated computation of quotient and remainder by powers of 10.
Rich (BB code):
DIGIT0  DIGIT1  DIGIT2  DIGIT3  DIGIT4
 
If X is a 16-bit integer,
and / is the operator for quotient,
and % is the operator for remainder.
 
DIGIT0  = X / 10,000
REM0    = X % 10,000
 
DIGIT1  = REM0 / 1,000
REM1    = REM0 % 1,000
 
DIGIT2  = REM1 / 100
REM2    = REM1 % 100
 
DIGIT3  = REM2 /10
DIGIT4  = REM2 % 10
 

haran

Joined Apr 6, 2008
42
can you teach me how to display the number if it ranges from 0 to 9 using one segment using vhdl language for maxplus+
 

Papabravo

Joined Feb 24, 2006
21,228
Use a WITH/SELECT statement like this:
Rich (BB code):
WITH bcd_in SELECT
out_segs <= "0000001" WHEN "0000",
            "1001111" WHEN "0001",
            "0010010" WHEN "0010",
            "0000110" WHEN "0011",
            "1001100" WHEN "0100",
            "0100100" WHEN "0101",
            "1100000" WHEN "0110",
            "0001111" WHEN "0111",
            "0000000" WHEN "1000",
            "0001100" WHEN "1001",
            "1111111" WHEN others;
 
Top