8048 Assembly Code Tomb

8048/mc146818 Clock with hex display

There are plenty of mc146818 clock chips around, since they were used in PC's for many years. These days you can even find many of the latter day clones of this device, a typical example might be a ds12887, or an oec12c887a. Surprisingly, some of these clones are still able to hold time, despite the lithium cells being a decade or more old. I've built up a clock using the 8048 series cpu, with the '6818 clone attached to the cpu as external memory. For the display, I used some HP 5082-7340's I had. This made the hardware interface quite simple -- it uses one 7408 package to buffer the data lines, since the 8048 drives only a single ttl load. I managed to find a T.I. SN7408N with a 7033 date code. This device is 36 years old at the time of this writing. There are five devices and six displays in the clock. This is the 8048 assembler code for the mc146818 based clock. B.G. Micro has the 8035 cpu for $1, and '6818 for $.80. I used a 2764 since I had a pile of them. It is Ludicrously more storage than needed, but they were cheaper than 2732's (wry smile). The displays will not be cheap, though. The TIL311 displays can also be used. The timebase is a 74HC4060 using a 32,768 Hz RTXO off an old PC motherboard. These old crystals were typically in an oscillator based on a 4069 inverter. Ironically, the '6818 was intended to allow its own RTXO circuit, but does not work properly, so designers had to use their own circuit.

I've created xcircuit schematics for this project. They are just drawings at the moment, without any electrical circuit information. The CPU portion is clock-8048.ps, the TOD clock is mc146818.ps, and the displays and driver is clock-display.ps.

This version has 8048 pins P2.6 and P2.7 free, and P2.0 thru p2.3 for output also, if you add the 74175 P2 data latch.

The 8048 CPU and memory graphic.

The 5082-7340 display graphic.

The '6818 clock chip and timebase graphic.

An optional 74175 P2 data latch graphic.

8048/mc146818 Clock with MUXed 7 segment display

Here's another version that uses "regular" seven segment displays and drives the output multiplexed. The four-for-a-dollar yellow HP dual displays work nicely. The seven segment mux version of the 8048 software can be set up for four or six digits of display. The xcircuit files are the clock-scan-buffer.ps, and the clock-digit-driver.ps drawings.

The time set routine uses the T1 input as the run/set test. The hours/minutes switch is P2.7, the fast set is P2.6, and the slow set is P2.5. Available for other use are P2.4 and T0 pins.

The 'ls645 buffer is rated for 24 milliamps current sink. I measured a segment with 100 ohm resistor as drawing 24.3 mA. Turning on all segments will cause a 195 mA current spike. Clank. Note that there is an 'ls645-1 version rated for 48 mA sink. I have not tried to push the HP displays to 48 milliamps, though, as I lack a proper data sheet for the displays.

Actually, I've looked at the data on a few of the modern (2014) displays and 24 milliamps is a good figure for constant drive. There does seem to be a "pulse" rating on one spec sheet for 150 or so milliamps. My concern would be for ambient range of this rating. My design for a hardware scan circuit would include a "timeout" single shot if I were to use the 48 milliamp drive of the 'ls645 driver. Oh, there's a 74128 quad gate with 48 mA drive I found I had a few of I might use.

The seven segment LED scan buffer driver graphic.

The digit driver graphic.

(This is the old, no time setting version of the code.)

If the thought of 8048 and assembly code gives you a rash, you can rejoice in my 8051 based C code version of the circuit.

Tri-Light Block Signal Controller

I had a few 8048's sitting around, so I designed a model railroad signal controller using one. Set up for a single track main, ABS, bi-directional, tri-light, eight signals (4 in each direction). The code reads a port (ttl input level) to sense the occupied blocks, and sets the tri-light signals appropriately.

The 8048 chips seem to be available for about one dollar or so from places like Jameco.

The block-sig.asm 8048 source code.