Difference between revisions of "URTC-8 Universal RTC for Z80 computers"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Downloads)
(Updated in line with actual tested software.)
Line 15: Line 15:
  
 
== Project status ==
 
== Project status ==
As of this time (April 2019), the uRTC boards are designed and in fabrication. Work has started on the utilities.
+
As of this time (August 2019), the uRTC boards are designed and I have received a set from the fabricators. An initial board has been built and work has started on the utilities. At the moment I have used the Superbrain as a test machine, and the utility uRTC.COM has been written and tested successfully. To get this working on the PCW, I will need to repair my CPS8256 serial/parallel adapter so that I can transfer uRTC.COM to my PCW for testing.
  
 
== Downloads ==
 
== Downloads ==
Along with the device itself, there are downloadable utilities:
+
Along with the device itself, there is downloadable utility.
* uRTC.COM allows the user to set and get the time on the RTC chip.
+
* 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.
* uRTCTX.com transfers the time and date to the host computer's operating system (normally CP/M). If you have uIDE-8 installed, add a call to this program to your PROFILE.SUB and locate the program on an IDE partition so it loads and runs faster.
+
* 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.
  
 
=== uRTC.COM ===
 
=== uRTC.COM ===
Use to set or display the time and date on uRTC-8.
+
Use to set or display the time and date on uRTC-8, or transfer it to the host computer.
  
  usage: uRTC - show date and time from the RTC clock"
+
  usage: uRTC [-t] [-q] - show date and time from the RTC clock"
         uRTC [[day] [dd/mm/yy] [hh:mm[:ss]]] [-b ADDR]"
+
         uRTC [[day] [dd/mm/yy] [hh:mm[:ss]]] [-t] [-q]"
 
  set RTC day/date/time"
 
  set RTC day/date/time"
  -b ADDR specify alternative uRTC base I/O register"
+
  -t transfer uRTC date/time to system clock"
        (default is A0)"
+
-q quiet mode, reports errors only"
  
 
The following examples should illustrate its use:
 
The following examples should illustrate its use:
Line 43: Line 43:
 
   A>uRTC
 
   A>uRTC
 
   Tue 18 Dec 2018 17:05:13
 
   Tue 18 Dec 2018 17:05:13
 +
  A>uRTC -t
 +
  Host RTC time set: Tue 18 Dec 2018 17:05:13
  
=== uRTCTX.COM ===
+
You can combine functions as well; so for example
A small utility that copies the time and date from uRTC-8 to the PCW's CP/M internal clock. Install it to the boot disk and call from PROFILE.SUB. If you have uIDE-8 installed, copy it to an IDE drive and call from PROFILE.SUB for improved speed.
+
 
 +
  A>uRTC Wed 19/12/18 -t
 +
 
 +
..would set the day of the week to Wednesday and the date to the 19th Dec 2018 on the RTC's clock, then transfer the new date and time to the host computer's system clock.
  
 
== Technical info ==
 
== Technical info ==
Line 56: Line 61:
 
Of particular interest are the 16 registers:
 
Of particular interest are the 16 registers:
  
  RTCBASE .equ 0A0h ; Default uRTC base I/O address
+
  RTCBASE .equ 0B0h ; uRTC base I/O address (Superbrain version)
 
  rtc1sec .db RTCBASE+00h ; 1 second digit
 
  rtc1sec .db RTCBASE+00h ; 1 second digit
 
  rtc10sec .db RTCBASE+01h ; 10 second digit
 
  rtc10sec .db RTCBASE+01h ; 10 second digit

Revision as of 05:10, 16 August 2019

uRTC-8 board render from OshPark
uRTC-8 3D render from KiCad

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.

About uRTC-8

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.

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.

Project status

As of this time (August 2019), the uRTC boards are designed and I have received a set from the fabricators. An initial board has been built and work has started on the utilities. At the moment I have used the Superbrain as a test machine, and the utility uRTC.COM has been written and tested successfully. To get this working on the PCW, I will need to repair my CPS8256 serial/parallel adapter so that I can transfer uRTC.COM to my PCW for testing.

Downloads

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.

uRTC.COM

Use to set or display the time and date on uRTC-8, or transfer it to the host computer.

usage: uRTC [-t] [-q] - show date and time from the RTC clock"
       uRTC [[day] [dd/mm/yy] [hh:mm[:ss]]] [-t] [-q]"
		set RTC day/date/time"
		-t transfer uRTC date/time to 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
 Host RTC time set: Tue 18 Dec 2018 17:05:13

You can combine functions as well; so for example

 A>uRTC Wed 19/12/18 -t

..would set the day of the week to Wednesday and the date to the 19th Dec 2018 on the RTC's clock, then transfer the new date and time to the host computer's system clock.

Technical info

This is the technical application manual for the 72421 RTC chip used in uRTC-8.


File:Rtc72421 appman.pdf


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


Prices

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. I encourage self build!

Item Price
uRTC-8 assembled £--.-- (hasn't been set yet)
Z80 Shim assembled (LHS or RHS) £17.50
PCW expansion port adapter with composite video output £4.00
PCW expansion port adapter with composite video output (assembled) £29.00
PCW expansion port adapter "lite" (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.