You can build a PC-based digital clock by reading the computer’s clock in a DOS-compatible 16-bit program and sending the time to display hardware through a real parallel port. The practical route is BIOS RTC time via INT 1Ah, followed by LPT output with OUT DX,AL. This is a legacy hardware-interfacing exercise: a USB printer adapter usually does not provide the register-level port access it requires, and the port should not power a display directly.
How the clock works
The PC supplies the time; the external circuit displays it. The program reads the time, formats or preserves its digits, and writes logic-level values to the parallel port. A latch, decoder, buffer, or driver circuit then connects those values to LEDs or seven-segment displays.
BIOS RTC or DOS time
↓
TASM program
↓
OUT DX,AL
↓
LPT registers and DB-25 pins
↓
latch / decoder / driver circuit
↓
display
Do not confuse this arrangement with making a software delay or the PC timer itself the clock. Unless an assignment specifically requires programming the timer, read the existing PC clock. A busy-wait loop is not a reliable one-second timebase.
Check feasibility before wiring
The easiest environment is real DOS or FreeDOS on a computer with an accessible hardware LPT port. Some older Windows environments and suitably configured emulators may also support relevant behavior, but compatibility depends on the system and its I/O access.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
- Real parallel port: A motherboard port or compatible expansion card is the best fit. Verify that the operating system or DOS environment can access its registers.
- USB printer adapter: Generally unsuitable. Such adapters usually emulate printer transfers rather than exposing the legacy registers needed by
OUT DX,AL. - Modern protected-mode Windows: An ordinary user-mode program generally cannot issue unrestricted I/O instructions; a suitable driver or specialized access mechanism is needed.
- Emulator: Useful for learning or assembling code, but it does not prove that a physical LPT circuit works. DOSBox-X is available at dosbox-x.com; check its configuration and hardware support for the intended use.
If the goal is simply a functioning clock rather than learning legacy x86 I/O, a microcontroller with an RTC module, USB GPIO device, or small single-board computer is usually more practical.
Hardware and safe wiring
Use a DB-25 breakout or clearly documented connector, an appropriate external supply for the display circuit, and a common ground between the PC port and that circuit. On a conventional PC parallel port, data signals are on DB-25 pins 2–9 and ground is commonly available on pins 18–25. Confirm pin numbering against the port and breakout documentation before connecting anything.
- Use current-limiting resistors for LEDs.
- Use a buffer or transistor driver when the display load requires more current than the port should provide.
- For seven-segment displays, choose compatible common-anode or common-cathode hardware and matching drivers.
- Consider a latch such as a 74HC373/74LS373, a BCD decoder such as a 4511 or 74LS47, or a driver array such as a ULN2803/ULN2003 where the circuit calls for one.
- Do not treat the LPT port as a power supply for multiple LEDs or a complete display.
A breakout board makes the individual pins easier to reach; it does not add protection or current-driving capability by itself.
Find the LPT base address and registers
For a conventional LPT port, the data register is at the base address, status is at base plus one, and control is at base plus two. The familiar addresses are conventions, not guarantees: verify the configured address in BIOS, DOS diagnostics, or the expansion-card documentation.
Rank #2
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
| Register | Offset | Common example | Purpose |
|---|---|---|---|
| Data | +0 |
378h for a commonly configured LPT1 |
Eight data outputs |
| Status | +1 |
379h when the base is 378h |
Status inputs |
| Control | +2 |
37Ah when the base is 378h |
Control signals |
Other traditional assignments include 3BCh for an alternate LPT1 and commonly 278h for LPT2. Define the address symbolically so it can be changed for the actual hardware:
LPT_BASE EQU 0378h
LPT_DATA EQU LPT_BASE
LPT_STATUS EQU LPT_BASE+1
LPT_CONTROL EQU LPT_BASE+2
OUT DX,AL writes the byte in AL to the I/O port whose address is in DX:
mov dx, LPT_DATA
mov al, 055h
out dx, al
The control register is not simply another bank of ordinary outputs. Traditional control signals can be electrically inverted, and their pin mapping and polarity can vary with implementation. Confirm the particular port’s documentation and measure or test the signal before assigning a latch clock or digit-enable function. Do not infer a working wiring plan just from a control-register byte value.
Choose a time source
BIOS RTC: the straightforward choice
BIOS INT 1Ah with AH=02h reads the real-time clock. On the documented BIOS interface, CH returns hours, CL minutes, and DH seconds, each in packed BCD. Check the carry flag after the interrupt; if it is set, treat the read as failed rather than displaying invalid data. See the PC BIOS Interface Technical Reference.
Rank #3
- Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
- 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
- ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
- ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
- ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
For example, 14h is packed BCD for decimal 14: the high nibble is the tens digit and the low nibble is the units digit. This is convenient for decoder-based displays, but it is not a seven-segment segment pattern. The circuit must either decode each BCD digit or software must convert the digits to segment codes.
DOS time service: another option
DOS INT 21h with AH=2Ch returns hours in CH, minutes in CL, seconds in DH, and hundredths in DL. Do not assume that its returned values have the same representation as the BIOS RTC fields; check the target DOS or emulator documentation before sending the values directly to BCD decoder hardware. The documented register interface is described in the DOS interrupt reference.
Why not time a loop?
A loop such as mov cx,0FFFFh followed by repeated LOOP instructions takes different amounts of time on different processors, emulators, and systems. It can provide a short demonstration hold between display actions, but it should not keep the clock’s seconds. The PC’s historical 8253/8254 timer uses a clock near 1.193182 MHz and occupies I/O ports 40h–43h; direct programming is a more advanced exercise because it can interfere with system timing. Background on the timer is available from The 8253 Timer and Timing on PC Family under DOS.
Test the data port before building the clock
Begin with a small, known load—such as individually current-limited LEDs through suitable interface circuitry—or a logic probe. Write fixed patterns to the data register and verify that the expected pins change. This isolates port access and wiring from timekeeping and display logic.
Rank #4
- Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
- Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
- Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
- EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
- Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.
- Confirm the base address and DB-25 pin numbering.
- Establish a shared ground between the port interface and external circuit.
- Write
00h,01h,55h,AAh, and0FFhto the data register. - Check the corresponding data pins or LEDs, including which logic level turns each indicator on.
- Only after the data test works, add a latch, decoder, or digit-selection control.
A fixed-pattern test is more useful than starting with a complete clock: if nothing changes, the cause is likely I/O permission, address, wiring, ground, or interface circuitry rather than RTC code.
Read the RTC and output a captured time
This small-model TASM/MASM-style example reads the BIOS time once, saves all three fields, and sends the packed BCD hour, minute, and second bytes in sequence. The saved snapshot prevents the program from mixing fields read at different moments. The sequence of output bytes is not by itself a complete six-digit display: external hardware must latch, decode, or otherwise interpret each byte.
TITLE RTC_LPT_CLOCK
.MODEL SMALL
.STACK 100h
.DATA
LPT_BASE EQU 0378h
LPT_DATA EQU LPT_BASE
saved_hour DB ?
saved_min DB ?
saved_sec DB ?
.CODE
main PROC
mov ax, @data
mov ds, ax
again:
; BIOS RTC read: CH=hour, CL=minute, DH=second (packed BCD)
mov ah, 02h
int 1Ah
jc rtc_error
; Preserve one consistent time snapshot.
mov saved_hour, ch
mov saved_min, cl
mov saved_sec, dh
mov dx, LPT_DATA
mov al, saved_hour
out dx, al
mov al, saved_min
out dx, al
mov al, saved_sec
out dx, al
; Demonstration pacing only; not a calibrated one-second clock.
call short_delay
; Exit when a key is available.
mov ah, 0Bh
int 21h
cmp al, 0
je again
mov ax, 4C00h
int 21h
rtc_error:
mov ax, 4C01h
int 21h
short_delay PROC
push cx
mov cx, 2000h
delay_loop:
loop delay_loop
pop cx
ret
short_delay ENDP
main ENDP
END main
For a conventional small-model executable, assemble and link with the tools available in your TASM installation:
tasm clock.asm
tlink clock.obj
clock.exe
Exact switches vary by TASM release and target. This example is an .EXE-style small-model program; a .COM program instead uses the tiny model and typically an ORG 100h layout, so it does not use the same source or ordinary linker workflow. TASM is a legacy tool; FreeDOS is available at FreeDOS, and NASM is an alternative assembler at nasm.us, though changing assemblers may require adapting the source and build process.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Turn the output into readable digits
Binary LEDs for bring-up
Sending seconds directly to the data register is a useful first functional test. It represents a value in binary, not a conventional decimal clock display; the LEDs show bits rather than two decimal digits.
BCD decoder per digit
A BCD decoder can drive a seven-segment digit from a four-bit decimal value. A two-digit field still needs a plan for presenting the tens and units nibbles, and a six-digit clock needs six digit values plus digit selection or separate decoder paths. Confirm the decoder’s display type, enable behavior, and active polarity before wiring.
Latch or multiplex the display
A latch holds a digit’s input while the program prepares the next value. In a multiplexed six-digit HH:MM:SS design, software repeatedly places one digit’s pattern on the data lines, enables that digit, waits briefly, disables it, and advances to the next digit. The scan must repeat rapidly enough to avoid visible flicker. The demonstration delay in the sample program is not a calibrated refresh rate, and control-line inversion or poor sequencing can cause ghosting or blank digits.
Before writing multiplexing code, specify what every line means: packed BCD versus binary versus segment pattern, which bits choose a digit, active-high or active-low enable, decoder/display type, and whether a latch edge is required. Without that circuit definition, there is no universal six-digit output routine.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Troubleshoot common failures
Nothing displays
- Run the fixed-pattern data-port test first.
- Verify the base address instead of assuming
378h. - Check DB-25 pin numbering and common ground.
- Confirm that the program’s operating environment permits direct I/O and that the machine has a real register-compatible LPT port.
- Test data output before control output; control polarity and wiring may differ.
- Check resistor placement, display polarity, decoder wiring, and whether a buffer or driver is required.
- Use a logic probe or oscilloscope to distinguish absent port transitions from a display-circuit fault.
Hour field is blank
Test the hour path independently using fixed BCD values such as 01h, 12h, and 23h. If the data pins change but the display does not, check whether the circuit expects separate nibbles, whether the hour latch is clocked, whether the digit-enable wire uses the intended control bit and polarity, and whether the display type matches its driver.
Minutes appear one minute ahead or fields disagree
Read all fields once and display the captured snapshot, as in the example. Reading the RTC separately for each field can cross a second or minute boundary and produce a mixed display. If the program already captures one snapshot, inspect the latch sequence, digit selection, BCD interpretation, and any software that increments or stores minutes independently. The original forum discussion reports display symptoms but does not establish a single verified circuit-and-code fix: All About Circuits project discussion and its mirrored discussion at Physics Forums.
Design choices at a glance
| Choice | Strength | Trade-off |
|---|---|---|
| BIOS RTC | Reads the system clock directly; documented fields are packed BCD. | Depends on a compatible BIOS/DOS environment. |
| DOS time service | Convenient API and includes hundredths. | Confirm data representation in the target implementation before decoder output. |
| Software delay loop | Simple for short holds or demonstrations. | Processor-dependent; not a reliable clock. |
| 8253/8254 timer programming | Useful for learning timer hardware. | More complex and can disturb system timing. |
| Binary LEDs | Fastest way to verify port output. | Not a human-readable clock display. |
| BCD decoders | Reduce segment-generation work in software. | Require digit selection and compatible wiring. |
| Multiplexed display | Can share lines across several digits. | Requires refresh, timing, and careful polarity handling. |
| Real LPT port | Matches the register-level project. | Uncommon on current computers. |
| PCI/PCIe parallel card | Can add a physical port to a desktop. | Addressing and DOS compatibility vary by card. |
| USB printer adapter | Convenient for printer-style connections. | Usually does not expose the legacy I/O registers this program needs. |
Practical conclusion
This is a worthwhile DOS-era project when the goal is to learn BIOS interrupts, BCD, x86 I/O instructions, and basic display interfacing. Build it in stages—fixed data patterns, RTC snapshot, then decoder or multiplexing hardware—and treat the LPT port as a source of logic signals, not display power. For a useful clock on current hardware, choose a modern controller and interface instead.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →

