我要在一台计算机 .minecraft.net/" rel="nofollow">我的世界。我了解如何构建一台可以进行二进制运算的计算机,但我希望输出显示为标准整数。如何将二进制文件“转换”为标准数字?有相关图表吗?并且数字将像旧计算器一样显示;有7行。
--
| |
--
| |
--
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.
--
| |
--
| |
--
发布评论
评论(5)
在电子学中,您需要的是所谓的“二进制到二进制编码的十进制”转换器。 “二进制编码的十进制”是在 7 段显示器上生成数字所需的一组位。 这里有一个 PDF 描述其中一款芯片的工作原理。 PDF 第 3 页显示了进行转换所需的真值表以及在硬件中实现该转换的所有 NAND 门的图片。您可以使用真值表来构建程序中所需的布尔表达式集。
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.
你看到这个模式了吗?公式如下:
Do you see the pattern? Here's the formula:
也许您正在寻找的称为 BCD 或二进制编码十进制。有一张图表和一张卡诺图,已经使用了几十年。快速谷歌搜索给了我这个技术页面
您打算如何组装计算机?
也许这个关键词至少可以帮助你找到你需要的东西。 :)
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. :)
您的问题有两个部分:
将二进制数转换为数字,即进行二进制到 BCD 的转换。
将数字转换为一组要激活的段。
对于后者,您可以使用 将活动段的位图分配给每个段的表数字。
Your problem has two parts:
Convert a binary number into digits, that is do a binary to BCD conversion.
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.
我认为这是两个不同的问题。
没有内置的“0/1 二进制字符串”到整数转换 - 您通常只需编写自己的字符串来循环并检测 2 的每个幂。
您还可以编写自己的 7 段 LED 显示屏 - 这是一个有点棘手,因为它有多行,但将是一个有趣的练习。
另外,大多数 GUI 都有 LCD 字体,Qt 当然也有
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