8-bit word to 4-digit, 7-segment display

W

weizbox

Guest
Hello,

Im pretty new to FPGAs in general and so far have gotten some basic
things down such as get data from my ADC and be able to hardwire
certin values into my 4 digit 7-segment display, but now I need to
combine the two and Im not sure how. Basicly I get an 8-bit binary
number from my ADC, from there how would I turn that number into
usable values to display on my 4-digit 7-segment display? Im using a
refence voltage value of 2.55 V just to make it easier for the time
being, but how do I turn "11111111" into "2.550" on ym display?

Thank you much for your time,
Mark
 
weizbox wrote:
Im pretty new to FPGAs in general and so far have gotten some basic
things down such as get data from my ADC and be able to hardwire
certin values into my 4 digit 7-segment display, but now I need to
combine the two and Im not sure how. Basicly I get an 8-bit binary
number from my ADC, from there how would I turn that number into
usable values to display on my 4-digit 7-segment display? Im using a
refence voltage value of 2.55 V just to make it easier for the time
being, but how do I turn "11111111" into "2.550" on ym display?
* Slam dunk: Learn to read voltages in hex :).

* Easy way: 256-word 12-bit lookup ROM on FPGA :)

* Not too hard: Set up two counters, a binary one &
a decimal one. Initialize the decimal
counter to 0. While the binary counter
is >0, decrement it & increment the
decimal counter. Hold this state machine
until the binary value changes, then
count down/up both counters until it
matches again.

* Just a little
more difficult: Use the counting above, except 2 loops --
one for the 100's digits, one for the
10's digit and you should be able to use
the remainder directly for the last digit.

This is similar to the way we used to do division on the
early microprocessors which didn't have a DIVide instruction.
 
"Carl W." <NoEmail@hp.com> wrote in message news:<41631ec1$1@usenet01.boi.hp.com>...
weizbox wrote:
Im pretty new to FPGAs in general and so far have gotten some basic
things down such as get data from my ADC and be able to hardwire
certin values into my 4 digit 7-segment display, but now I need to
combine the two and Im not sure how. Basicly I get an 8-bit binary
number from my ADC, from there how would I turn that number into
usable values to display on my 4-digit 7-segment display? Im using a
refence voltage value of 2.55 V just to make it easier for the time
being, but how do I turn "11111111" into "2.550" on ym display?

* Slam dunk: Learn to read voltages in hex :).

* Easy way: 256-word 12-bit lookup ROM on FPGA :)

* Not too hard: Set up two counters, a binary one &
a decimal one. Initialize the decimal
counter to 0. While the binary counter
is >0, decrement it & increment the
decimal counter. Hold this state machine
until the binary value changes, then
count down/up both counters until it
matches again.

* Just a little
more difficult: Use the counting above, except 2 loops --
one for the 100's digits, one for the
10's digit and you should be able to use
the remainder directly for the last digit.

This is similar to the way we used to do division on the
early microprocessors which didn't have a DIVide instruction.


Any site that you know of in which it tells you how to set up a ROM? I
have a table I could use, but as far as getting it on the ROM, im a
little cluesless.

-Mark
 
Any site that you know of in which it tells you how to set up a ROM? I
have a table I could use, but as far as getting it on the ROM, im a
little cluesless.

-Mark
The FPGA manufacturer should have information on how to set up the memory
contents, both as application notes and in their device library reference.
For instance, the Xilinx Libraries Guide (in the online Software Manual)
describes the use of the INIT_00 to INIT_0F constraints to initialize the
RAMB4_S16 which would provide 16 bits of output for your 8 bits of input.


http://toolbox.xilinx.com/docsan/xilinx6/books/data/docs/lib/lib0344_330.html

You only have 3 digits for 0.01 to 2.55. To avoid using binary to 7-segment
conversion, I'd just code the bottom 2 digits as the 7 segments - 14 bits
total - and use the other 2 bits for the 0/1/2 indication with a simple
wiring to get your elements.

There's a little bit of work in getting the data formatted, but it's pretty
straight-forward.

If, on the other hand, you don't want to bother with the memory at all you
could figure out the digits through logic and do the binary to BCD and BCD
to 7-segment conversions in the chip. The binary-to-BCD is a bit tough
because it involves division through the three stages to get your digits.

Dig1 = int(Val/100)
Dig2 = int((Val-Dig1*100)/10)
Dig3 = Val-Dig1*100-Dig2*10

Since the math isn't simple, the "direct" approach probably isn't the way to
go.

I loved the suggestion of using a BCD counter to read the binary value and
decrement it to zero, each decrement causing an increment on the BCD counter
starting from zero. Your result is a BCD count in less than 256 cycles.
The BCD to 7-segment conversion is a simple case statement.

- John_H
 

Welcome to EDABoard.com

Sponsor

Back
Top