Z80 Project

Nathan's Z80 Project Mark 2: Real Time Clock

Last updated: Aug. 20, 2009, 10:41 p.m.

The only additional feature I actually included in this project was the Real Time Clock (RTC) chip. I had got hold of this chip a couple of years back and was planning on using it in the Z80 Project (Mark 1). It was the last one Farnell had in stock and was then discontinued by them, I believed at the time that they were generally going out of production but I found this evening that they are still an "active" product according to Texas Instruments. There seems to be stock available from Digi-Key.

The chip provides a real time clock (i.e. counts seconds, minutes, hours etc.) as well as a number of additional functions with its built in CPU supervisor. There is a watchdog timer as well as brown-out detection and NVSRAM control. I'm only using it as a clock and counter though. There are only three components to fit to make it work which is one of the great advantages of this elderly technology, the chip itself which shares much of its pinout with a standard RAM chip, a 32.768kHz watch crystal and a small backup battery. I've opted for a coin cell holder to take a standard "2032" coin cell, like you'll probably find in most desktop PCs you've seen. This keeps the clock in it ticking over while the computer is off so that its date and time are still correct next time you start up.

Schematic of the parallel RTC circuit

The interrupt line is the real reason I included it though. It has internal facilities to generate an interrupt periodically (once per second, minute, hour etc. up to month) using the alarm, or more frequent interrupts, from just over 30uS to half a second, using the periodic, counter interrupt. This attracted me to the device, as there is no internal counter in the Z80 and I have grown accustomed to writing multi-tasking systems that jump to another task on a timer based interrupt.

The circuit diagram is very simple as the chip just plugs into the Z80's IO address space with minimal fuss. It fitted perfectly into my decode logic, I've assigned it the IO range from $10-$1F, each of those address giving direct access to one of its internal registers (e.g. seconds, hour, year, or interrupt enable). This should make it a very easy part to include in software, but a real advantage to the overall system.

Datasheets BQ4845 RTC with CPU supervisor.

Section:
Z80 Project
Tags:
retro-puting,
Z80 Mark 2,
Z80 homebrew

Comments

Posting comments is not currently possible. If you want to discuss this article you can reach me on twitter or via email.


Contact

Email: nathan@nathandumont.com

Twitter: @hairymnstr

Links