Discussion in 'Programmer's Corner' started by marwa, Jan 6, 2008.

1. ### marwa Thread Starter New Member

Jan 6, 2008
3
0
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!!

2. ### Papabravo Expert

Feb 24, 2006
12,272
2,721
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.
Code ( (Unknown Language)):
1.
2. DIGIT0  DIGIT1  DIGIT2  DIGIT3  DIGIT4
3.
4. If X is a 16-bit integer,
5. and / is the operator for quotient,
6. and % is the operator for remainder.
7.
8. DIGIT0  = X / 10,000
9. REM0    = X % 10,000
10.
11. DIGIT1  = REM0 / 1,000
12. REM1    = REM0 % 1,000
13.
14. DIGIT2  = REM1 / 100
15. REM2    = REM1 % 100
16.
17. DIGIT3  = REM2 /10
18. DIGIT4  = REM2 % 10
19.

3. ### marwa Thread Starter New Member

Jan 6, 2008
3
0
thanx million that was alot of help

4. ### haran Active Member

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

5. ### Papabravo Expert

Feb 24, 2006
12,272
2,721
Use a WITH/SELECT statement like this:
Code ( (Unknown Language)):
1.
2. WITH bcd_in SELECT
3. out_segs <= "0000001" WHEN "0000",
4.             "1001111" WHEN "0001",
5.             "0010010" WHEN "0010",
6.             "0000110" WHEN "0011",
7.             "1001100" WHEN "0100",
8.             "0100100" WHEN "0101",
9.             "1100000" WHEN "0110",
10.             "0001111" WHEN "0111",
11.             "0000000" WHEN "1000",
12.             "0001100" WHEN "1001",
13.             "1111111" WHEN others;
14.

6. ### uchi28 New Member

Aug 5, 2008
1
0
hi guys
can you help me, how to display the number in seven segment using vhdl for quartus II 5.0

thx