diff --git a/hardware/panel-mockup-vintage.png b/hardware/panel-mockup-vintage.png index 5b5c148..52cba2f 100644 Binary files a/hardware/panel-mockup-vintage.png and b/hardware/panel-mockup-vintage.png differ diff --git a/hardware/panel.md b/hardware/panel.md index 49c3a4f..05a4c42 100644 --- a/hardware/panel.md +++ b/hardware/panel.md @@ -32,7 +32,7 @@ | 信息 | 表示 | |---|---| -| 指针位置 | 矩阵里闪的红圈(光标) | +| 指针位置 | 矩阵下方的 **6 颗红氖泡(二进制 `dp`)** | | 64 格的 LSB | 矩阵灯的亮/灭(`biz`/`rnz` 唯一看的那一位) | | 当前格整字节 | CELL 灯环 | | 当前指令 | INSTRUCTION 灯 | @@ -40,16 +40,16 @@ ### 3.1 指针怎么标(重要) -**灯泡不能变色**,而且在灯泡矩阵里**单独点亮某一格是做不到的**:矩阵按行/列驱动,动一条线会亮一整排(8 格)。所以"指针那格变红"需要 64 路独立驱动(每格一个门),不划算。 +**灯泡不能变色**,而且在灯泡矩阵里**单独点亮某一格是做不到的**:矩阵按行/列驱动,动一条线会亮一整排(8 格)。所以指针不能靠"那一格变色/闪烁"。 -用的是**十字光标**: +**定案:`dp` 单独用 6 颗红色氖泡按二进制显示**,放在矩阵下方,左边是 bit 5、右边是 bit 0: -- 矩阵**左侧 8 颗**红色氖泡 = 行,**上方 8 颗**红色氖泡 = 列; -- `dp` 是 6 位,正好拆成 `dp[5:3]`(行)和 `dp[2:0]`(列),**直接驱动,不用任何译码器**; -- 亮着的一行 + 一列在矩阵上交叉,交点就是 `dataptr` 的位置。 +- 直接接 `dp` 计数器的 `Q` 输出,**不用译码器**(74LS07 / ULN2803 开集缓冲即可驱动氖泡); +- 6 颗灯解决 64 个位置,比"十字光标"(16 颗)省,而且没有歧义; +- 二进制是机器自己的表示,不算"数字读数",和"结果走串口"的原则不冲突。 + +(也考虑过:矩阵左侧 8 + 上方 8 颗红氖做十字光标 —— 交点即指针;或者每格一颗红氖环的第二套矩阵。前者 16 颗、后者 80 颗,都不如 6 颗二进制直白。) -也可以做成"每格一颗红氖环"(第二套 8×8 矩阵,和第一套**共用 16 路驱动线**、用一根 select 分时), -那样红点直接落在格子上,代价是 64 颗氖泡 + 面板密度翻倍。**推荐十字光标**:16 颗灯、零译码、看得很清。 ## 4. 电气 | 项 | 值 | @@ -57,7 +57,7 @@ | 灯环 | 8 × 6 V 灯丝灯泡,ULN2803 驱动(8 路),一个 74LS273 锁存当前格 | | 指令灯 | 8 × 6 V,另一片 ULN2803 + 74LS138 译码 | | 矩阵 | 8 行 + 8 列扫描,**16 路驱动**(灯泡矩阵无需每格独立驱动) | -| **指针光标** | 见 §3.1:矩阵**左侧 8 颗 + 上方 8 颗红色氖泡**做十字线,`dp[5:3]` 直接驱动行、`dp[2:0]` 直接驱动列 —— 零译码 | +| **`dp` 显示** | 6 颗红氖泡,直接接计数器 `Q` 输出(74LS07/ULN2803 缓冲),见 §3.1 | | 拨码 | 8 位 → 74LS244 → 输入字节总线;SEND = 一个按钮 → `,` 的握手 | | 按钮 | STEP/START/HALT/RESET 各一个,74LS14 去抖 | | 电源 | 5 V(TTL)· 6 V(灯)· 12 V(可选),外置 5 V 2 A 适配器 | diff --git a/hardware/panel_mockup_vintage.py b/hardware/panel_mockup_vintage.py index 47c2bf1..fdcb3b1 100644 --- a/hardware/panel_mockup_vintage.py +++ b/hardware/panel_mockup_vintage.py @@ -188,23 +188,26 @@ def main(): d.ellipse([p(COL[1] + 45.4), p(49.0), p(COL[1] + 52.6), p(56.2)], fill=RED_BUTTON, outline=(70, 24, 20), width=p(0.25)) - # ---- DATA 64: lamp matrix, with a crosshair cursor for dp --------------- - # A lamp cannot change colour, and in a matrix one cell cannot be driven on - # its own -- changing a row or column line lights eight cells. So the pointer - # is not a cell property at all: eight red neons down the left (row) and eight - # above (column) make a crosshair, and the lit pair crosses at the dp cell. + # ---- DATA 64: the 64 cells, and dp in binary --------------------------- + # The matrix shows one bit per cell (the LSB, the only bit biz and rnz test). + # A single cell cannot be lit specially in a matrix -- a row or column line + # drives eight cells -- so where the pointer is gets its own six red neons, + # straight off the dp counter: no decoder, and no ambiguity. section(d, COL[2], 24.6, "DATA 64", 56) - mx, my, pitch, lrad = COL[2] + 8.0, 32.6, 3.9, 1.3 + mx, my, pitch, lrad = COL[2] + 8.2, 30.6, 3.7, 1.25 pattern = [0x9C, 0x71, 0x23, 0xC8, 0x4E, 0x96, 0x3B, 0xA5] - dp_row, dp_col = 4, 1 for row in range(8): for col in range(8): x = mx + col * pitch y = my + row * pitch lamp(d, g, x, y, lrad, bool((pattern[row] >> (7 - col)) & 1)) - for i in range(8): - lamp(d, g, mx - 4.2, my + i * pitch, 1.15, i == dp_row, CURSOR) - lamp(d, g, mx + i * pitch, my - 4.2, 1.15, i == dp_col, CURSOR) + + d.text((p(COL[2] + 1.0), p(59.4)), "DP", font=font(1.4), fill=INK_DIM) + dp = 33 + for i in range(6): + x = COL[2] + 7.6 + (5 - i) * 6.4 # bit 5 on the left, bit 0 right + lamp(d, g, x, 60.6, 1.7, bool((dp >> (5 - i)) & 1), CURSOR) + d.text((p(x - 0.6), p(62.8)), str(5 - i), font=font(1.1), fill=INK_DIM) # ---- lower row --------------------------------------------------------- d.line([p(12), p(65.4), p(RIGHT), p(65.4)], fill=ORANGE, width=max(1, p(0.3)))