Awes0meE / 66CCFF LabXJTLU Undergraduate西交利物浦大学本科生
Back to notes返回笔记

2024.04 to 2024.05

Reading The Digital Clock Brief As A Build PlanDigital Clock 课件学习报告

A learning report that reads the MEC104 Digital Clock slides as a build plan, connecting the two-digit roll-over rule, BCD decoding, button levels, and the small Arduino sketches used before the final breadboard counter.MEC104 Digital Clock 课件先给出两位计数器的搭建路线,再把两位归零规则、BCD 译码、按键电平和最终面包板计数器前的两个 Arduino 小 sketch 串起来。

ArduinoBCDSeven-Segment DisplayCourse NoteEmbedded
Related Project相关项目Arduino Breadboard Digital Clock CounterArduino 面包板两位数码管计数器

Starting From The Brief从课件要求开始

The useful thing about the Digital Clock handout is that it does not give a complete wiring recipe. It gives a small product requirement first: build a two-digit clock-like counter, make it start, stop, and reset, then make the roll-over value depend on the group number. For me at that stage, this was already a shift from "write an Arduino loop" to "make a physical system follow a rule."

这份 Digital Clock 课件有用的地方,是它没有直接给一份完整接线说明。它先给的是一个很小的产品要求:做一个两位数字钟式计数器,可以开始、暂停、复位,并且归零点要跟小组号有关。对当时的我来说,这已经从“写一个 Arduino 循环”变成了“让一个真实电路按规则运行”。

Basic two-digit and button requirements / 两位显示与按键要求
Basic two-digit and button requirements两位显示与按键要求

The homework report later made the group rule more concrete. Our group was A17, so the display needed to count from 16 to 17, return to 0, and then keep counting if the switches were not touched. That small rule forced the program to keep track of the current value, the roll-over condition, and the pause/reset input state at the same time.

后来的作业报告把小组规则写得更具体。我们是 A17 组,所以显示要从 16 增加到 17,再回到 0;如果不操作开关,就继续往后计数。这个小规则会逼着程序同时处理当前数值、归零条件、暂停/复位输入状态。

Splitting The Circuit把电路拆开看

The slide that helped me read the project was the basic structure page. It separates the build into Arduino, decoder, and display. That sounds simple now, but it was a useful way to turn the breadboard from one dense bundle of wires into three paths I could check. The Arduino generates four-bit BCD signals, the decoder maps those bits to seven-segment outputs, and the display is only the visible end of the chain.

真正帮我读懂项目的是 Basic Structure 这一页。它把系统拆成 Arduino、译码器和显示三段。现在看很基础,但当时这个拆法很有用,因为它让我可以把一团跳线拆成三条链路去查。Arduino 负责输出四位 BCD 信号,译码器负责把这些 bit 映射到七段输出,数码管只是末端能看见的那一段。

Course system structure / 课程中的系统结构拆分
Course system structure课程中的系统结构拆分

The BCD decoder page then turns the middle block into something checkable. The handout mentions the A-D input pins, the a-g outputs, 330 ohm resistors before the LED segments, IC orientation markers, and the need to power every IC with Vcc and GND. Those details are easy to skip in a drawing, but they are exactly the details that decide whether the number shows correctly on a real display.

BCD 译码器这一页,又把中间那一块变成了可以检查的东西。课件提到 A-D 输入、a-g 输出、每一路 LED 前面的 330 欧限流电阻、芯片方向标记,以及每颗 IC 都要接 Vcc 和 GND。这些细节在图里很容易被略过,但放到实物上,数字能不能正常显示就靠这些地方。

BCD decoder notes / BCD 到七段译码器说明
BCD decoder notesBCD 到七段译码器说明

The single-digit-bcd-counter.ino file is the smallest version of this display path. It maps Arduino pins 9, 10, 11, and 12 to A/B/C/D, stores the BCD values in a lookup table, writes one row to the output pins, waits for one second, then advances the number. It only drives one digit, so the decoder logic is easier to see than in the final two-digit wiring.

single-digit-bcd-counter.ino 是这条显示链路的最小版本。它把 Arduino 的 9、10、11、12 号引脚映射成 A/B/C/D,把 BCD 值写在查表数组里,每次把一行写到输出引脚,等一秒,再推进数字。它只带一位数码管,所以比最终两位接线更容易看清译码逻辑。

Buttons Were Their Own Problem按键是单独的问题

The button slide looks like a side note, but it points to a very real beginner problem: digitalRead() only means something when the input level is defined. A floating input can make the code look wrong even when the actual problem is the circuit around the switch.

按键这一页看起来像旁边的小知识,但它指向的是入门时很真实的问题:digitalRead() 只有在输入电平确定的时候才有意义。悬空输入会让代码看起来像是错的,其实问题可能在开关周围那一小段电路。

Button pull-up and pull-down notes / 按键上下拉说明
Button pull-up and pull-down notes按键上下拉说明

The separate digital-read-key.ino sketch is basically a probe for that problem. It reads two input pins and prints the pause/reset states through Serial. The standalone sketch uses pins 7 and 6, while the final report records D2 and D3 for the two switches. I read this as a normal development trace: first make the input observable in a small test, then move the pin plan into the final wiring.

单独留下的 digital-read-key.ino 基本就是为这个问题写的小探针。它读取两个输入脚,再通过 Serial 打印暂停/复位状态。这个独立 sketch 用的是 7 号和 6 号引脚,最终报告里记录的两路开关则是 D2 和 D3。我把它看成一条正常的开发痕迹:先用小测试让输入变得可观察,再把引脚规划放进最终接线里。

The report also says the six-pin switch took time to figure out. The final wiring used a 10k ohm pull-up to VCC, with the other side grounded, so the Arduino pin reads low when the switch is pressed. This is the kind of small hardware detail that a pure software exercise would never force me to face.

报告里还写到,六脚按键按下时到底哪条路径导通,当时花了一些时间才弄清楚。最终接法是用 10k 欧上拉到 VCC,另一端接地,所以按下时 Arduino 引脚读到低电平。这种小硬件细节,纯写软件练习不会逼我去面对。

From Slides To The Breadboard从课件到面包板

The milestone slide gives a good reading order for the remaining files: timing generator, decoder, display, programming, and testing. The TinkerCAD one-digit demo belongs near the beginning of that path. The assessed circuit was the real breadboard build; this demo still helps because it shows the BCD-to-display idea before the breadboard adds two digits, two decoder chips, and two switches.

里程碑那一页给了一个很适合读文件的顺序:计时发生器、译码器、显示、程序和测试。TinkerCAD 的一位数码管 demo 应该放在这条线的前面看。最终考核看的是实物面包板;这份 demo 仍然有用,因为它能在真实面包板接入两位数码管、两颗译码芯片和两个开关之前,先把 BCD 到显示这条思路跑清楚。

Milestone breakdown / 课程里程碑拆分
Milestone breakdown课程里程碑拆分
TinkerCAD one-digit demo / TinkerCAD 一位归零计数 demo
TinkerCAD one-digit demoTinkerCAD 一位归零计数 demo

The final report fills in the part that the course slides and small sketches do not show together: units and tens are separated with Num % 10 and (Num / 10) % 10, then each digit writes four BCD bits to its own decoder. The report PDF is kept as a public artifact now, so the project page can show both the cleaned screenshots and the original two-page write-up.

最终作业报告补上了课件和小 sketch 没有放在一起展示的那部分:用 Num % 10(Num / 10) % 10 拆出个位和十位,再让每一位分别输出四个 BCD bit 到自己的译码器。现在报告 PDF 原件也作为公开文件保留了,项目页里既能看到整理过的截图,也能打开原始两页报告。

Files I Would Still Keep现在还值得保留的文件

  • Button input probe is useful because it isolates pause/reset readings from the full counter.
  • One-digit BCD sketch is useful because it isolates the decoder lookup table.
  • Homework report PDF is useful because it records the final pin split, group A17 roll-over rule, and the switch wiring lesson.
  • Demo video is useful because it shows the counter running as a physical breadboard build.
  • 按键输入探针 值得保留,因为它把暂停/复位读数从完整计数逻辑里拆出来了。
  • 一位 BCD sketch 值得保留,因为它把译码查表单独拎出来了。
  • 作业报告 PDF 值得保留,因为它记录了最终引脚拆分、A17 组归零规则和开关接线这几个细节。
  • 演示视频 值得保留,因为它证明这个计数器后来确实在面包板上跑起来了。

Looking Back现在回头看

This was my second real contact with embedded ideas, before I had PCB experience. A lot of concepts were still fuzzy: common-anode versus common-cathode displays, IC pin order, current limiting, switch paths, and why an input pin needs a defined level. The value of this project is that all of those ideas had to pass through visible hardware. If one link was wrong, the number on the display changed wrong, stayed blank, or the button state became strange.

这是我第二次比较正式地接触嵌入式相关内容,还在我会画 PCB 之前。很多概念当时都很模糊:共阳和共阴数码管、IC 引脚顺序、限流、开关导通路径、为什么输入脚需要确定电平。这个项目有价值的地方在于,这些概念都要经过看得见的硬件。如果某一段错了,数码管上的数字就会显示错、干脆不亮,或者按键状态变得很怪。

现在再看这份课件,它更像一张搭建路线图:先读规则,再拆模块,再把一位显示和按键输入分别验证,然后把它们合到两位计数器里。这个过程不复杂,但它把嵌入式里的输入、输出、状态和调试第一次具体地摆到了我面前。

Looking back, the handout works like a build map: read the rule, split the system, test one-digit display and button input separately, then combine those pieces into the two-digit counter. The project is small, but it made input, output, state, and debugging feel concrete for the first time.