Difference between revisions of "Real Time Clock"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Notes)
Line 48: Line 48:
 
== Notes ==
 
== Notes ==
  
Also in 1986, the same magazine released another RTC as part of the [[Schneiderware]] series (published in the normal issues, not in the special Sonderheft issues). Both solutions used similar but not identical 4bit RTC chips (the chips have different pin-outs, and some of the 4bit registers aren't exactly the same, for example, the leap-year bits are different).
+
Also in 1986, the same magazine released another RTC ([[Schneiderware Real Time Clock]]) as part of the [[Schneiderware]] series (published in the normal issues, not in the special Sonderheft issues). Both solutions used similar but not identical 4bit RTC chips (the chips have different pin-outs, and some of the 4bit registers aren't exactly the same, for example, the leap-year bits are different).
  
 
[[Category:Hardware]] [[Category:Peripherals]] [[Category:DIY]]
 
[[Category:Hardware]] [[Category:Peripherals]] [[Category:DIY]]

Revision as of 11:36, 30 September 2010

This Real Time Clock addon was published as a DIY project in a special edition of the German magazine CPC Schneider International Sonderheft, issue #3-1986.

Like most other homecomputers of the era, the Amstrad CPC did not include a Real Time Clock. This project overcomes this limitation.

Technical specs

Uses a RTC-58321 chip (with 4bit databus and built-in 32.786kHz oscillator), four 74LSxx chips, and a rechargeable battery. Port addresses are jumper-selectable (the defaults, used in the included example program, are FBE2h/FBE3h):

 FBE2h FBE6h FBEAh FBEEh FBF2h FBF6h FBFAh FBFEh - RTC-58321 Index (W)
 FBE3h FBE7h FBEBh FBEFh FBF3h FBF7h FBFBh FBFFh - RTC-58321 Data (R/W)

All registers are 4bit wide (Bit0-3 used, Bit4-7=don't care/garbage):

 0  S1    Seconds units    (0..9)
 1  S10   Seconds tens     (0..5) (bit3=unused)
 2  MI1   Minutes units    (0..9)
 3  MI10  Minutes tens     (0..5) (bit3=unused)
 4  H1    Hours units      (0..9)
 5  H10   Hours tens       (0..1 or 0..2) (bit2=PM, bit3=24-hour)
 6  W     Day-of-week      (0..6) (bit3=unused) (Epson datasheet: 0=Sunday)
 7  D1    Day units        (0..9)
 8  D10   Day tens         (0..3) (bit2-3=Leap year offset, usually zero)
 9  MO1   Month units      (0..9)
 A  MO10  Month tens       (0..1) (bit1-3=unused)
 B  Y1    Year units       (0..9)
 C  Y10   Year tens        (0..9)
 D  RES   Reset register   (strobe) (bit0-3=unused)
 E  REF   Reference signal (bit0=1024Hz, bit1=1sec, bit2=1min, bit3=1hour)
 F  REF   Reference signal (bit0=1024Hz, bit1=1sec, bit2=1min, bit3=1hour)

In 24hour mode: range is 00:00 to 23:59 and the PM flag is always zero. In 12hour mode: range is 12:00 AM to 11:59 PM. Day and month start counting with one (ie. 01..31 and 01..12). Day-of-Week is a general purpose 7-day counter (the Epson datasheet suggests 0=Sunday, the CPC magazine suggests 0=Monday). Leap years are generated when "((Year + LeapYearOffset) MOD 4)=0", which can be matched to different calendars:

 1926..1989   Showa 1..64     (reign of japanese emperor Hirohito)
 1989..today  Heisei 1..today (reign of japanese emperor Akihito)

Ie. for Gregorian and Heisei calendars set LeapYearOffset=0, for Showa calendar set LeapYearOffset=1 (as described in the CPC magazine). Anyways, the article recommends to use Gregorian calendar, ie. using year=86 for 1986, so, if the battery survived, it wrapped to year=00 in year 2000.

How to build a RTC interface (German)

Datasheets

Notes

Also in 1986, the same magazine released another RTC (Schneiderware Real Time Clock) as part of the Schneiderware series (published in the normal issues, not in the special Sonderheft issues). Both solutions used similar but not identical 4bit RTC chips (the chips have different pin-outs, and some of the 4bit registers aren't exactly the same, for example, the leap-year bits are different).