Binary to Seven Segment Display?
Author Message
Binary to Seven Segment Display?

Can someone tell me the easiest way or give me an example of how to
convert a 10 bit binary number into the correct format for a seven
segment display

Example:

a
_
b |_| c
e |d|f
-
g

There will be one set of display lines and 3 select outputs through a
multiplexer.

Wed, 10 Mar 2004 02:20:56 GMT
Binary to Seven Segment Display?

Quote:
> Can someone tell me the easiest way or give me an example of how to
> convert a 10 bit binary number into the correct format for a seven
> segment display

> Example:

>        a
>        _
>     b |_| c
>     e |d|f
>        -
>        g

> There will be one set of display lines and 3 select outputs through a
> multiplexer.

You need to say if you want to display binary,decimal or hex.
If hex, then it is easy.
Define a 16 x 7 ROM entity and initialize it according to you needs.
Instantiate three times and use the binary number as the addresses
"00"&NUM[9 downto 8]
NUM[7 downto 4]
NUM[3 downto 0]

Alternatively instantiate one ROM and do it in three clock cycles.

You are really only in trouble if you try to display decimal, and you then
have to convert from 10 bit binary to 4 digit decimal.

--
Best regards,
ulf at atmel dot com
The contents of this message is intended to be my private opinion and
may or may not be shared by my employer Atmel Sweden

Wed, 10 Mar 2004 03:29:46 GMT
Binary to Seven Segment Display?
A 10-bit number?  How many 7-seg displays are you going to use, and are
you going to display it in hex or binarary?  The actaul mechanics of
getting a hex number to display are easy, but if you want to display it
in decimal, the bin->dec conversion will be harder then the 7-seg decoder
will be.
Mike

Quote:

> Can someone tell me the easiest way or give me an example of how to
> convert a 10 bit binary number into the correct format for a seven
> segment display

> Example:

>        a
>        _
>     b |_| c
>     e |d|f
>        -
>        g

> There will be one set of display lines and 3 select outputs through a
> multiplexer.

Wed, 10 Mar 2004 04:00:56 GMT
Binary to Seven Segment Display?

Quote:
>Can someone tell me the easiest way or give me an example of how to
>convert a 10 bit binary number into the correct format for a seven
>segment display

>Example:

>       a
>       _
>    b |_| c
>    e |d|f
>       -
>       g

>There will be one set of display lines and 3 select outputs through a
>multiplexer.

You might find this easier if you name the segments in accordance with
the industry standard:

a
_
f |_| b
e |g| c
-
d

Reference:
SN7447 data sheet.
http://www-s.ti.com/sc/psheets/sdls111/sdls111.pdf

Is this a sub-component of a vending machine controller?

Regards,
Allan.

Wed, 10 Mar 2004 20:52:05 GMT
Binary to Seven Segment Display?
It will be displayed as a decimal, the max value to display would be
999. The spec has no mention of values above this, the real values
expected are to be in the tens max anyway.

I been told that the decoder could be quite complicated, I thought
that there might be a code example on the web somewhere that I just
haven't been able to find.  The board allows for a full Xilinx
XCR3064XL VQ44 to be used just for the display driver so space
shouldn't be a problem.

Does anyone have any suggestions on how to approach the algorithm?

what about std_logic_vector to Integer, then mod and div functions?
Are these functions synthesizable in VHDL?

Matt

Fri, 12 Mar 2004 03:55:24 GMT
Binary to Seven Segment Display?
Since your binary is only 10  bits, the easiest approach would be to use
a look-up table.  You'd need a 1kx7 memory, which can be done with just
2 Block Rams in the virtex architecture, or 4 EABs in Altera 10K.
Another approach would be to use BCD arithmetic instead of binary for
whatever is generating the 10 bit binary (you'd have 12 bit bcd
instead).  Either of these are less complex than doing a conversion.

Quote:

> It will be displayed as a decimal, the max value to display would be
> 999. The spec has no mention of values above this, the real values
> expected are to be in the tens max anyway.

> I been told that the decoder could be quite complicated, I thought
> that there might be a code example on the web somewhere that I just
> haven't been able to find.  The board allows for a full Xilinx
> XCR3064XL VQ44 to be used just for the display driver so space
> shouldn't be a problem.

> Does anyone have any suggestions on how to approach the algorithm?

> what about std_logic_vector to Integer, then mod and div functions?
> Are these functions synthesizable in VHDL?

> Matt

--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930     Fax 401/884-7950

http://www.andraka.com

"They that give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
-Benjamin Franklin, 1759

Fri, 12 Mar 2004 05:37:01 GMT
Binary to Seven Segment Display?
do two loops  which each handle one digit and then use the remainder.
-- pseudo code

function lcd(digits)
i = 0;
loop
if(digits > 100) begin
i++;
digits -= 100;
else
exit;
end if;
end loop;
lcd[2] = i;

i = 0;
loop
if(digits > 10) begin
i++;
digits -= 10;
else
exit;
end if;
end loop;
lcd[1] = i;
lcd[0] = digits;
end function

This should take 20-25 clock cycles, which is probably fast enough.

--
Best regards,
ulf at atmel dot com
The contents of this message is intended to be my private opinion and
may or may not be shared by my employer Atmel Sweden

Quote:
> It will be displayed as a decimal, the max value to display would be
> 999. The spec has no mention of values above this, the real values
> expected are to be in the tens max anyway.

> I been told that the decoder could be quite complicated, I thought
> that there might be a code example on the web somewhere that I just
> haven't been able to find.  The board allows for a full Xilinx
> XCR3064XL VQ44 to be used just for the display driver so space
> shouldn't be a problem.

> Does anyone have any suggestions on how to approach the algorithm?

> what about std_logic_vector to Integer, then mod and div functions?
> Are these functions synthesizable in VHDL?

> Matt

Fri, 12 Mar 2004 16:04:39 GMT
Binary to Seven Segment Display?
Are student exercises so often solved on the internet that you're not
even willing to look at the logic diagram for devices that do this bit
of work?

Is this supposed to be a TRUE 10-bit binary number, or something
limited to decimal 0..999?

Look at 14553,which is a 3 decade multiplexed counter, and 74C925..9,
which is a multiplexed counter with built-in display, for example.
Each solves parts of the problem.  I haven't looked at these in years,
but theconcepts probably still work.

The TTL 7446..9 or things of that ilk might be worth examining as
well, along with the BCD=>bin/bin=>BCD devices (74184/5 & 74484/5)
also have things to contribute.

Perhaps that's what you're supposed to learn.

Dick

Quote:
>Can someone tell me the easiest way or give me an example of how to
>convert a 10-bit binary number into the correct format for a seven
>segment display

>Example:

>       a
>       _
>    b |_| c
>    e |d|f
>       -
>       g

>There will be one set of display lines and 3 select outputs through a
>multiplexer.

Thu, 25 Mar 2004 03:12:10 GMT
Binary to Seven Segment Display?

Quote:

> Are student exercises so often solved on the internet that you're not
> even willing to look at the logic diagram for devices that do this bit
> of work?

Sorry but this was not a student exercise, it was for a device that
had to fit in a case so small there was only room for 2 VQ44 pin PLDs
on the board and very little else, the first device was filled with
the SPI memory read/write controller and incrementer.  If there was
room for a VQ100 to replace a VQ44 then the design would have been
simple but even with 4 ply board there was only 1mm either side of the
chip on it's width which could not handle the routing.

The solution was to use a BCD counter and yes it was only required to
count from 0 to 999 decimal, any values above this could be ignored
because it should never be in this region anyway (10's MAX!) so if it
hits 999 then it's lucky not to have broken down earlier!

Matt

Fri, 26 Mar 2004 23:55:22 GMT

 Page 1 of 1 [ 9 post ]

Relevant Pages