URTC-8 Universal RTC for Z80 computers
- 1 What's an "RTC"?
- 2 About uRTC-8
- 3 Project status
- 4 Downloads
- 5 Using timestamps with CP/M plus files
- 6 Technical info
- 7 Prices
- 8 Copyright
- 9 Disclaimer
- 10 Support
- 11 How to contact me.
- 12 Salutation
What's an "RTC"?
In case you didn't know.. an "RTC" is a "Real Time Clock" - in this instance, a clock that maintains the time even when the host computer it is connected to is switched off. It is separate to the clock inside the computer; so, for example, the Amstrad CP/M Plus DATE.COM command prints the time and date from the internal clock only. However, it is the user's responsibility to enter the time and date each time the host computer is turned on if he/she wants DATE.COM to return the right information. Using an external RTC like uRTC-8, you can get the computer to perform this task automatically at each start up.
uRTC-8 is a universal RTC that can be connected via a Z80 Shim to any Z80 computer that has a socketed CPU. It is also compatible with the uIDE-8 PcW expansion port adapters. Both of these connectivity options present a 40 way "Z80 Bus" and you can connect uRTC-8 to this bus, in parallel with other devices on the bus.
uRTC-8 uses an 8 bit comparator and a set of jumpers to enable I/O base address selection, just like uIDE-8. The RTC used is an Epson RTC72421 which has 16 registers, directly accessible via IN and OUT instructions. As a result, the base I/O address is a four bit number between 0000 and 1111 (0-15), putting the device at any of the I/O addresses 00h, 10h, 20h, 30h, 40h, 50h, 60h, 70h, 80h, 90h, A0h, B0h, C0h, D0h, E0h or F0h. From any of these base addresses to [base address + 0Fh] are the 16 registers of the Epson RTC. The default base address is 80h, and this is what uRTC.COM expects. Contact me if you need to set a different I/O base address.
uRTC-8 is powered by the host computer, but also has a battery backed supply to maintain the time and date when the host is powered down. The battery is a common CR2032 3v button cell.
uRTC-8 is designed to work on the Z80 bus implemented by uIDE-8. The intention is that the board is connected to the Z80 bus in parallel to uIDE-8 to provide a means to set the host computer's clock at boot time, automatically. The uRTC-8 board is exactly the same size as uIDE-8 with matching mounting holes, so they can be stacked one above the other using PCB standoffs.
Refer to the uIDE CPC Wiki page for further details on connectivity options. You don't need uIDE-8 in order to use uRTC-8 but you will need to choose a way to connect it to your computer. PCWs can use Z80 shim or the expansion port adapter; other Z80 computers can use the Z80 shim.
- Hardware description and Superbrain demo: https://youtu.be/POBRlgAFxmo
- PCW (CP/M Plus) demo: https://youtu.be/CDJlPLYHUEA
Pictures of the finished board
Single board with no battery fitted yet.
A uRTC-8 stacked on a uIDE-8 board using plastic stand offs.
Aux PWR and Aux Batt connectors
As supplied, I do not provide header pins for Aux PWR or Aux Batt pads. If you want to use either of them, solder standard 2.54mm pitch header pin pairs and connect to those.
- Aux PWR is a 5v power line that is fed from the host computer. It is supplied as a convenience to allow you to provide power to other devices. Do not attempt to use it as a power input.
- Aux Batt is an alternative battery connector, to be used if you do not want to use the built in CR2032 button cell. If you use Aux Batt, you *must* remove the button cell first, and the voltage you need to apply is 3v - 5v. The clock chip can tolerate up to 7v but it is not advisable to go this high as you risk damaging it.
For both connectors, observe the connection polarity printed on the PCB.
As of this time (October 2019), the uRTC boards are designed and I have received a set from the fabricators. An initial board has been built and work is completed on the uRTC.COM utility. It's ready for ordering.
Along with the device itself, there is downloadable utility.
- uRTC.COM allows the user to set and get the time on the RTC chip, and transfer the time to the host system's RTC.
- There will be a version of uRTC.COM for each supported host computer, because transferring the RTC datetime to the computer is different in each case, and the base I/O address may differ.
Download the latest variant that matches your host computer, rename to uRTC.COM and transfer to your computer.
CP/M Plus variant
Note: When you set the system time on the PCW (-t option), the second is always set to 0.
Use to set or display the time and date on uRTC-8, and / or transfer it to the host computer.
usage: uRTC - show date and time from the RTC clock" uRTC [[dd/mm/yy] [hh:mm[:ss]]] [-ts|p] [-q] - set RTC day/date/time" -t transfer uRTC date/time to host machine system clock" -q quiet mode, reports errors only"
The following examples should illustrate its use:
A>uRTC Tue 10 Nov 2017 12:42:36 A>uRTC 18/12/18 Tue 18 Dec 2018 12:42:52 A>uRTC 17:05 Tue 18 Dec 2018 17:05:00 A>uRTC 17:05:55 Tue 18 Dec 2018 17:05:55 A>uRTC Tue 18 Dec 2018 17:05:13 A>uRTC -t CP/M Plus system time set: Tue 18 Dec 2018 17:05:13
You can combine functions as well; so for example
A>uRTC 19/12/18 -t
..would set the date to the 19th Dec 2018 on uRTC's clock, then transfer the new date and current uRTC time to the host computer's system clock.
uRTC.com handles the year 2000 issue in the same way as the Y2K compliant CP/M Plus DATE.COM:
- When the year entered is before 78, uRTC will assume it is in the 21st century (2000s)
- When the year entered is 78 or above, uRTC will assume it is in the 20th century (1900s)
The clock chip itself does not store the century.
Setting the system time automatically on the PCW
Use the CP/M Plus / PCW version of uRTC.COM.
To automatically set the PCW system time, add the following line to the PROFILE.SUB file of the boot disk:
Before first use, set the uRTC-8 clock time as shown in the usage section. Now, at each boot, the CP/M Plus system time is set automatically from the battery backed clock on the uRTC-8 board.
Setting the system time automatically on the Superbrain
Use the Superbrain version of uRTC.COM.
The Superbrain has no automatic boot command capability; however, if you are using uRTC-8 you can use the XSETCMD.COM program to set an initial boot command. The one you want is:
If you are not using uIDE-8 on your Superbrain, you will have to remember to enter the command manually each time you boot. Advanced users may patch the CCP on the boot disk directly to inject the command.
Before first use, remember to set the uRTC-8 clock time as shown in the usage section. Now, at each boot, the Superbrain system time is set automatically from the battery backed clock on the uRTC-8 board.
Additional CP/M software required
You will also need a copy of INITDIR.COM: Download link
Using timestamps with CP/M plus files
A full description of how to configure a CP/M Plus system for timestamps can be found on page 592 of the [CP/M 3 user guide].
In a nutshell:
First, use INITDIR [drive] to create space in the drive's directory for the timestamps. For example:
It will ask you if you want to reformat the directory. Don't worry, no files will go missing, but if you attempt this on a drive with many files, it may run out of directory space.
Once the directory is reformatted, you use SET to set the sort of timestamps you want.
A>SET A: [CREATE=ON]
..will turn on file creation timestamps (the time is recorded when a file is created)
A>SET A: [UPDATE=ON]
..will turn on update timestamps (the time is recorded when a file is updated)
A>SET A: [ACCESS=ON]
..will turn on access timestamps (the time is recorded when a file is opened). This option disables CREATE - the two options are mutually exclusive.
Now, use DIR with option [FULL] to see the timestamps (after you've created / updated / accessed any files). You will see the timestamps on the far right of the directory listing. Where a timestamp is missing, it means that the file hasn't been accessed / created / updated since the INITDIR operation.
For PCW users, be aware that Locoscript does not support datestamps on CP/M file systems properly, so it is not recommended to use INITDIR on any disk that is used to store Locoscript files (including CP/M disks you want to read files from within Locoscript).
This is the technical application manual for the 72421 RTC chip used in uRTC-8.
Of particular interest are the 16 registers:
RTCBASE .equ 0B0h ; uRTC base I/O address (Superbrain version) rtc1sec .db RTCBASE+00h ; 1 second digit rtc10sec .db RTCBASE+01h ; 10 second digit rtc1min .db RTCBASE+02h ; 1 minute digit rtc10min .db RTCBASE+03h ; 10 minute digit rtc1hour .db RTCBASE+04h ; 1 hour digit rtc10hour .db RTCBASE+05h ; 10 hour digit (also AM/PM indicator) rtc1day .db RTCBASE+06h ; 1 day digit rtc10day .db RTCBASE+07h ; 10 day digit rtc1month .db RTCBASE+08h ; 1 month digit rtc10month .db RTCBASE+09h ; 10 month digit rtc1year .db RTCBASE+0Ah ; 1 year digit rtc10year .db RTCBASE+0Bh ; 10 year digit rtcweek .db RTCBASE+0Ch ; day of week rtccrtlD .db RTCBASE+0Dh ; control register D rtcctrlE .db RTCBASE+0Eh ; control register E rtcctrlF .db RTCBASE+0Fh ; control register F
This is a summary of the prices I have posted to the forum so far. I am sorry that the assembled prices are what they are, but it is a time consuming and dreary job, not to mention the effort and cost to acquire the parts.
|Z80 Shim assembled (LHS or RHS)||£17.50|
|PCW expansion port adapter with composite video output (board only)||£4.00|
|PCW expansion port adapter with composite video output (assembled)||£29.00|
|PCW expansion port adapter "lite" (board only, without composite video output)||£3.00|
|PCW expansion port adapter "lite" (without composite video output, assembled)||£18.00|
|Z80 bus cable (40 way IDC-IDC ribbon)||n/a - buy from online action site; "40 way IDC cable"|
|UK postage & packing boards only||£3.50|
|UK postage & packing assembled packages||£5.50|
|European countries postage & packing boards only||£8.00|
|European countries postage & packing assembled packages||£12.00|
|Rest of the world postage & packing boards only||£14.00|
|Rest of the world postage & packing assembled packages||£18.00|
Payment via PayPal, please, in Sterling (GBP). All prices are plus shipping as shown and PayPal fees (send as a gift).
The shipping prices are a reasonable estimate and should allow a tracked service. Please contact me if you would like shipping insurance. All shipping will be via UK Royal Mail services.
Please note, you will also need a Z80 bus cable. This is a standard 40 way IDC female to female ribbon commonly found in PCs to connect the motherboard to an IDE HDD, so if you have one lying around you don't need to buy one. If you already use a uIDE card, you can add a connector to the existing cable.
All designs presented here are copyrighted works.
Copyright (C) Jon Bradbury 2017.
- VCF Forum http://www.vcfed.org/forum/forum.php member "JonB"
- CPCWiki Forum http://www.cpcwiki.eu/forum/forum/ member "JonB"
- Amstrad.ES Forum member "JonB"
As I am a hobbyist, not a big business, I need to make a few things clear.
You are free use these designs for personal or commercial purposes, on the following conditions:
- You do not attempt to take credit for the work I have put into designing and / or building any device offered here.
- You acknowledge my right to assert copyright and ownership of these designs.
- You agree to indemnify me and the CPCWiki web site against damage to your computer or other connected hardware or data contained on any attached media.
- All work is undertaken at your own risk. I am not liable for any hardware damage or data loss, loss of your homework, your dog getting sick, etc.
- All devices and/or PCBs I offer are supplied as-is and there is no warranty that they are fit for any particular purpose.
- Your agreement to these conditions is implicit on ordering any of these devices or PCBs from me.
I will support your use of these designs via the appropriate forum by offering help and advice as necessary. Please review the content of this Wiki page before asking for help, though, and contact me via the channels described below.
How to contact me.
I am member "JonB" of the VCF and CPC Wiki and Amstrad.ES Forums. If you need support or have any comments, please start a new thread on the VCF CP/M forum here:
Or on the relevant CPCWiki / Amstrad.ES forum linked to above. You could also PM me.. :)
Note: Forum registration is required.
CPCWiki Forum Member "JonB" (Jon Bradbury) 01/10/2019