The STC15W204S is an 8051-based MCU and the brain of the whole project. Almost every available I/O pin is used — the only ones left free are P3.0 (RXD) and P3.1 (TXD) which are reserved for serial programming, everything else is connected to the display logic, RTC module, buttons, or buzzer.
To drive the 4-digit 7-segment display without using all the pins, I used a single 74HC164 shift register. Segment data is clocked in serially and then the MCU rapidly cycles through each of the 4 digits one at a time, switching fast enough that all 4 digits appear to be on at the same time to the human eye.
For timekeeping, the DS1302 RTC module communicates with the STC15 over its own 3-wire protocol using a clock line, data line, and chip enable line. This keeps accurate time even when the clock is in other modes like alarm or timer.
On the software side, the firmware is written in C and runs a state machine that manages three modes: time, alarm, and timer. Before entering each mode the display shows the mode name in letters first. The clock supports 16 individually configurable alarms, and when one triggers it activates a buzzer and flashes which alarm number was set on the display. Since no stc15.h header file existed for this MCU I had to write my own from scratch, manually defining all the SFRs and bit addresses needed. The firmware also includes custom button debounce logic to prevent false presses from being registered.
The whole thing is powered over a power supply and currently running on a breadboard prototype. The next step is finishing the KiCad PCB design and moving it into a proper enclosure.
Bohan Xu
sjm4306
Xed89
It looks like you're using a very old version of KiCad either v6 or v5.1. Unless your PC is old you really should take advantage of a recent version such as v9.0.9. v10 will take a while to stabilise and it's easy to upgrade your project then anyway.