docs: ADC 注入流程 §4 补码值刻度图

§4 的「码」定义表只有文字与数字,台架现场容易把 TPAFE 的
152.59 µV 与 STM32 的 805.66 µV 混着用。新增一张刻度尺对照
图(docs/images/ADC码值刻度.svg),上下两把尺子分别标出
11430 码 ≈ 1.744 V 与 1000 码 ≈ 0.806 V,把"同一整数在两片
转换器上代表不同电压"变成可见的;正文补一句两把尺子差 5.3
倍、§9 每格必须写明所属通道。

生成器 tools/arch_diagram/gen_adc_code_scale_svg.py 沿用图形绘制
流程 §3.2 约定(纯标准库 / html.escape / newline="\n" /
ElementTree 自检 + 文字溢出预检);码制与 LSB 数据集中在
PANELS 常量,换芯片才重画。已登记到 tools/arch_diagram/README.md
与 docs/架构设计/图形绘制流程.md 的生成器表 + 变更记录。

目检用无头 Chrome 截图完成(cairosvg 未装,截图不入库)。
This commit is contained in:
2026-10-27 17:25:51 +08:00
parent e50d2b5cf0
commit 2b4c0e97c2
5 changed files with 256 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
<svg xmlns="http://www.w3.org/2000/svg" width="980" height="512" viewBox="0 0 980 512" font-family="Microsoft YaHei, Segoe UI, PingFang SC, sans-serif">
<rect x="0" y="0" width="980" height="512" fill="#ffffff"/>
<text x="60" y="44" font-size="20" font-weight="700" fill="#0f172a">「码」是 ADC 的最小刻度 —— 两片转换器的刻度大小不同</text>
<text x="60" y="72" font-size="13" fill="#64748b">ADC 输出的是整数(码),不是电压;电压 = 码 × LSB,所以要先知道「1 码值多少伏」</text>
<text x="60" y="92" font-size="13" fill="#64748b">TPAFE5160:16 位双极性,65536 码 = 10 V 跨度 · STM32 ADC1:12 位单极性,4096 码 = 3.3 V 跨度</text>
<text x="60" y="150" font-size="14" font-weight="700" fill="#0f172a">A · TPAFE5160(16 位双极性)</text>
<line x1="60.0" y1="162.0" x2="920.0" y2="162.0" stroke="#cbd5e1" stroke-width="1"/>
<text x="60" y="180" font-size="12" fill="#64748b">码范围 −32768 ~ +32767 · 每 1 码 = 152.59 µV</text>
<line x1="100.0" y1="238.0" x2="900.0" y2="238.0" stroke="#334155" stroke-width="1.8"/>
<line x1="100.0" y1="232.0" x2="100.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="140.0" y1="232.0" x2="140.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="180.0" y1="232.0" x2="180.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="220.0" y1="232.0" x2="220.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="260.0" y1="232.0" x2="260.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="300.0" y1="232.0" x2="300.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="340.0" y1="232.0" x2="340.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="380.0" y1="232.0" x2="380.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="420.0" y1="232.0" x2="420.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="460.0" y1="232.0" x2="460.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="500.0" y1="232.0" x2="500.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="540.0" y1="232.0" x2="540.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="580.0" y1="232.0" x2="580.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="620.0" y1="232.0" x2="620.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="660.0" y1="232.0" x2="660.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="700.0" y1="232.0" x2="700.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="740.0" y1="232.0" x2="740.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="780.0" y1="232.0" x2="780.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="820.0" y1="232.0" x2="820.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="860.0" y1="232.0" x2="860.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="900.0" y1="232.0" x2="900.0" y2="244.0" stroke="#94a3b8" stroke-width="1"/>
<text x="100" y="260" font-size="11" text-anchor="middle" fill="#94a3b8">−32768</text>
<text x="900" y="260" font-size="11" text-anchor="middle" fill="#94a3b8">+32767</text>
<text x="500.0" y="260" font-size="11" text-anchor="middle" fill="#64748b">0</text>
<line x1="639.5" y1="232.0" x2="639.5" y2="210.0" stroke="#2563eb" stroke-width="1" stroke-dasharray="3 3"/>
<circle cx="639.5" cy="238.0" r="5" fill="#2563eb"/>
<text x="639.5263671875" y="202" font-size="13" text-anchor="middle" font-weight="700" fill="#2563eb">11430 码 ≈ 1.744 V</text>
<text x="60" y="328" font-size="14" font-weight="700" fill="#0f172a">B · STM32 ADC1(12 位单极性)</text>
<line x1="60.0" y1="340.0" x2="920.0" y2="340.0" stroke="#cbd5e1" stroke-width="1"/>
<text x="60" y="358" font-size="12" fill="#64748b">码范围 0 ~ 4095 · 每 1 码 = 805.66 µV</text>
<line x1="100.0" y1="416.0" x2="900.0" y2="416.0" stroke="#334155" stroke-width="1.8"/>
<line x1="100.0" y1="410.0" x2="100.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="200.0" y1="410.0" x2="200.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="300.0" y1="410.0" x2="300.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="400.0" y1="410.0" x2="400.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="500.0" y1="410.0" x2="500.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="600.0" y1="410.0" x2="600.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="700.0" y1="410.0" x2="700.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="800.0" y1="410.0" x2="800.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<line x1="900.0" y1="410.0" x2="900.0" y2="422.0" stroke="#94a3b8" stroke-width="1"/>
<text x="100" y="438" font-size="11" text-anchor="middle" fill="#94a3b8">0</text>
<text x="900" y="438" font-size="11" text-anchor="middle" fill="#94a3b8">4095</text>
<line x1="295.4" y1="410.0" x2="295.4" y2="388.0" stroke="#0d9488" stroke-width="1" stroke-dasharray="3 3"/>
<circle cx="295.4" cy="416.0" r="5" fill="#0d9488"/>
<text x="295.36019536019535" y="380" font-size="13" text-anchor="middle" font-weight="700" fill="#0d9488">1000 码 ≈ 0.806 V</text>
<line x1="60.0" y1="452.0" x2="920.0" y2="452.0" stroke="#cbd5e1" stroke-width="1"/>
<text x="60" y="470" font-size="12" fill="#64748b">刻度疏密仅示意位数差(16 位比 12 位细),不是逐码绘制;1 码的电压当量见各行右侧标注。</text>
<text x="60" y="488" font-size="12" fill="#64748b">两个换算值都来自台架实测码值:11430 与 cal: 行的 1743 mV 自洽,说明「码 × LSB」这条链是通的。</text>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB