hardware: the pointer becomes a crosshair cursor, because one lamp cannot be special
ci / linux-arm64 (push) Successful in 5m0s

The question was what kind of lamp can turn from yellow to red, and the honest
answer is none, and it would not help anyway: in a lamp matrix a single cell cannot
be driven on its own.  The matrix lights cells by row and column, so changing either
line lights eight cells, and giving every cell its own override would mean 64 extra
gates or 64 separate lines.

So the cursor is a separate indicator.  Eight red neons down the left of the matrix
and eight across the top form a crosshair, and the lit pair crosses at the data
pointer.  dp is six bits, which splits exactly into dp[5:3] for the row and dp[2:0]
for the column: sixteen lamps, zero decode logic.

The alternative is a red neon ring in every cell, driven as a second 8 by 8 matrix
that shares the sixteen drive lines and is selected in time, so the red dot lands on
the cell itself.  That is 64 more neons and twice the panel density; the crosshair is
recommended for now.  panel.md records both, with the reasoning.
This commit is contained in:
dsh committed 2026-11-24 19:08:15 +08:00
1 parent f69925817c
commit 7144e8fefe
3 files changed
+28 -16

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 108 KiB

+13 -1
View File
@@ -38,6 +38,18 @@
| 当前指令 | INSTRUCTION 灯 |
| 结果 / 步数 / 调试 | **串口** |
### 3.1 指针怎么标(重要)
**灯泡不能变色**,而且在灯泡矩阵里**单独点亮某一格是做不到的**:矩阵按行/列驱动,动一条线会亮一整排(8 格)。所以"指针那格变红"需要 64 路独立驱动(每格一个门),不划算。
用的是**十字光标**:
- 矩阵**左侧 8 颗**红色氖泡 = 行,**上方 8 颗**红色氖泡 = 列;
- `dp` 是 6 位,正好拆成 `dp[5:3]`(行)和 `dp[2:0]`(列),**直接驱动,不用任何译码器**;
- 亮着的一行 + 一列在矩阵上交叉,交点就是 `dataptr` 的位置。
也可以做成"每格一颗红氖环"(第二套 8×8 矩阵,和第一套**共用 16 路驱动线**、用一根 select 分时),
那样红点直接落在格子上,代价是 64 颗氖泡 + 面板密度翻倍。**推荐十字光标**:16 颗灯、零译码、看得很清。
## 4. 电气
| 项 | 值 |
@@ -45,7 +57,7 @@
| 灯环 | 8 × 6 V 灯丝灯泡,ULN2803 驱动(8 路),一个 74LS273 锁存当前格 |
| 指令灯 | 8 × 6 V,另一片 ULN2803 + 74LS138 译码 |
| 矩阵 | 8 行 + 8 列扫描,**16 路驱动**(灯泡矩阵无需每格独立驱动) |
| 指针红圈 | 指针行列额外 OR 进去(2 个门)+ 一个 555 或 74LS161 分频做闪烁 |
| **指针光标** | 见 §3.1:矩阵**左侧 8 颗 + 上方 8 颗红色氖泡**做十字线,`dp[5:3]` 直接驱动行、`dp[2:0]` 直接驱动列 —— 零译码 |
| 拨码 | 8 位 → 74LS244 → 输入字节总线;SEND = 一个按钮 → `,` 的握手 |
| 按钮 | STEP/START/HALT/RESET 各一个,74LS14 去抖 |
| 电源 | 5 V(TTL)· 6 V(灯)· 12 V(可选),外置 5 V 2 A 适配器 |
+15 -15
View File
@@ -29,6 +29,7 @@ STEEL = (150, 148, 144)
DARK = (30, 27, 24)
LAMP_OFF = (58, 44, 32)
LAMP_ON = (255, 178, 56)
CURSOR = (232, 66, 44) # red neon: the crosshair that marks dp
RED_BUTTON = (122, 40, 32)
# one module grid: three columns, two rows, 4 mm gutters
@@ -74,14 +75,14 @@ def screw(d, x, y, r=1.5):
width=max(1, p(0.25)))
def lamp(d, g, x, y, r, lit):
def lamp(d, g, x, y, r, lit, colour=LAMP_ON):
d.ellipse([p(x - r - 0.5), p(y - r - 0.5), p(x + r + 0.5), p(y + r + 0.5)],
fill=(92, 86, 78), outline=(70, 65, 58), width=max(1, p(0.18)))
if lit:
g.ellipse([p(x - r * 1.5), p(y - r * 1.5), p(x + r * 1.5), p(y + r * 1.5)],
fill=LAMP_ON + (190,))
fill=colour + (190,))
d.ellipse([p(x - r), p(y - r), p(x + r), p(y + r)],
fill=LAMP_ON if lit else LAMP_OFF)
fill=colour if lit else LAMP_OFF)
def slide_switch(d, x, y, up):
@@ -187,24 +188,23 @@ 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: the lamp matrix ------------------------------------------
# ---- 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.
section(d, COL[2], 24.6, "DATA 64", 56)
mx, my, pitch, lrad = COL[2] + 2.6, 30.4, 4.6, 1.5
mx, my, pitch, lrad = COL[2] + 8.0, 32.6, 3.9, 1.3
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):
idx = row * 8 + col
x = mx + col * pitch
y = my + row * pitch
if idx == 33:
g.ellipse([p(x - lrad * 2.2), p(y - lrad * 2.2),
p(x + lrad * 2.2), p(y + lrad * 2.2)],
fill=(255, 120, 60, 170))
d.ellipse([p(x - lrad - 0.5), p(y - lrad - 0.5),
p(x + lrad + 0.5), p(y + lrad + 0.5)],
outline=(196, 74, 40), width=max(1, p(0.45)))
else:
lamp(d, g, x, y, lrad, bool((pattern[row] >> (7 - col)) & 1))
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)
# ---- lower row ---------------------------------------------------------
d.line([p(12), p(65.4), p(RIGHT), p(65.4)], fill=ORANGE, width=max(1, p(0.3)))