Question

I'm going to make a computer in Minecraft. I understand how to build a computer where it can make binary operations but I want the outputs to be displayed as standard integer numbers. How you "convert" the binaries into standard digits? Is there any chart for that? And the digits will be shown like in old calculators; with 7 lines.

 --
|  |
 --
|  |
 --
Was it helpful?

Solution

In electronics, what you need is called a "binary to binary coded decimal" converter. "Binary coded decimal" is the set of bits needed to produce a number on a 7 segment display. Here's a PDF describing how one of these chips works. Page 3 of the PDF shows the truth table needed to do the conversion as well as a picture of all of the NAND gates that implement it in hardware. You can use the truth table to build the set of boolean expressions needed in your program.

OTHER TIPS

0 = 0
1 = 1
10 = 2
11 = 3
100 = 4
101 = 5
110 = 6
111 = 7
...

Do you see the pattern? Here's the formula:

number = 2^0 * (rightmost digit)
       + 2^1 * (rightmost-but-1 digit
       + 2^2 * (rightmost-but-2 digit) + ...

Maybe what you are looking for is called BCD or Binary Coded Decimal. There is a chart and a karnaugh map for it that has been used for decades. a quick Google search for it gave me this technical page http://circuitscan.homestead.com/files/digelec/bcdto7seg.htm

How are you trying to build the computer? Maybe that key word can at least help you find what you need. :)

Your problem has two parts:

  1. Convert a binary number into digits, that is do a binary to BCD conversion.

  2. Convert a digit into a set of segments to activate.

For the latter you can use a table that assigns the bitmap of active segments to each digit.

I think's that's two different questions.

There isn't a "binary string of 0/1" to integer conversion built in - you would normally just write your own to loop over the string and detect each power of 2.

YOu can also write your own 7segment LED display - it's a little tricky because it's on multiple lines, but would be an interesting excersize.

Alternatively most GUIs have an LCD font,Qt certainly does

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top