浮点数面板仪表计算器
Panel meter calculator with floating point

原始链接: https://lcamtuf.substack.com/p/panel-meter-calculator-with-floating

这位作者自称是一名“计算器极客”,他着手利用一种非传统的机电显示装置打造了一款定制计算器。该项目从缺乏现代数字接口的历史设备中汲取灵感,使用了七个面板电压表——通过定制的背胶面板进行改装——来显示数字和浮点运算结果,并设有负数和溢出指示灯。 该项目的制作非常考究,采用了数控铣削的亚克力显示面板和手工制作的枫木外壳。交互界面使用了一个配有 NKK 触感开关的非标准 4x4 键盘。内部由一颗 8 位 AVR128DA28 微控制器负责硬件管理。为确保精度,作者在软件中实现了自定义的定点算术运算,在处理分数和错误状态等复杂操作的同时,规避了浮点数学带来的复杂性。 最终打造出的“Calcumator 2000”将复古美学与现代嵌入式控制融为一体,是对计算机交互界面历史的一次创意探索。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交登录 带浮点功能的面板仪表计算器 (lcamtuf.substack.com) 6 分,由 surprisetalk 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 讨论 帮助 考虑申请 YC 2026 秋季班!申请截止日期为 7 月 27 日。 准则 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Unusual clocks are a common idea for electronics DIY projects. The difficulty is never the timekeeping part; it’s making the clock look presentable. For my own take on the theme, you can check out the article I posted in May:

Clocks aside, some readers might recall that I’m a bit of a calculator nerd. For a while, calculators lagged behind general-purpose computing because of the lack of a suitable display technology. Some of the early designs used ticker tape, cathode ray tubes, or incandescent lightbulb panels to display the result:

A bit surprisingly, though, there were scarcely any calculators with electromechanical displays, so I decided to address this glitch.

I started with a 3 mm sheet of acrylic. I spray-painted the back side blue:

I then selectively removed some paint with and cut a number of openings on a CNC mills:

The areas with lettering were then painted again to give these areas contrast and a cool three-dimensional look.

I constructed the display itself out of six generic “SO-45” panel voltmeters from Amazon, plus one vintage edgewise voltmeter scored on eBay. The meters are fitted with custom faces printed on adhesive paper (template file):

Here’s the assembled panel, also embellished with two Dialight 656 series panel indicators (catalog page) that signal negative results and overflows:

And yep, the edgewise meter in the middle is obviously used for floating point.

The panel was the easy part; next, I had to come up with an enclosure. Because the panel is fairly massive, I decided to use a non-standard keyboard layout: ten digits and a decimal point in a two rows on the left, and then five operator keys in a cluster to the right.

Electrically, the keypad is still a 4×4 grid with four driven rows and four column sense lines.

I made the enclosure from thin maple lumber stock resawn in my workshop. The lettering and the recessed key matrix were once again machined on a CNC mill:

Here’s a photo of the glue-up:

The keypad uses sixteen relatively fancy 18×18 mm NKK JF series tactile switches (catalog here). I made custom vinyl decals for each key.

Here’s the photo of the finished enclosure:

The final portion of the project is the control circuitry. Some folks egged me on to implement analog calculations, but that would make the calculator even less practical — and if you want to take that route, purely-mechanical designs are more fun. So, the brains of the operation is an 8-bit AVR128DA28 MCU.

The chip is powered directly from a 5 V wall wart. It uses pulse-width modulation on seven digital lines (PD0-PD6) to drive the meters, a 4×4 sense-drive grid (PA0-PA3 / PA4-PA7) to scan the keypad, and two lines (PC0, PC1) for the indicator lamps.

I’ll spare you the walkthrough of the software architecture because it’s fairly straightforward. About the most interesting part is the implementation of fixed-point (6+5 digit) arithmetic to avoid the accuracy issues related to floats. You can download the source here; it’s short and commented well.

As discussed earlier on this blog, calculator UI is hell and the code makes several choices related to that. It allows repeated operations by pressing “+”, “×”, or “÷” twice, but reserves “-” as a prefix for changing sign, except if pressed right after the equals key. It also interprets dual “=” as an instruction to clear calculator state because the keypad doesn’t have a dedicated “C” button.

And now, the moment you’ve all been waiting for. The clip shows the handling of fractions, negative numbers, and error conditions:

That’s all.

If you liked the article, you’ll enjoy The Secret Life of Circuits. It’s a richly illustrated, lucid introduction to electronics — from the physics of conduction to embedded system programming. It features 290+ color diagrams, 420+ pages of original content, and zero AI.

I write about electronics, the foundations of mathematics, the history of technology, and other geek interests. If you like it, please subscribe.

联系我们 contact @ memedata.com