Home‎ > ‎C64 projects‎ > ‎

DS3231 & DS1307 RTC in C64

Updated 20.09.2018 - Added version 0.2

Cheap and easy way to add Real Time Clock for your C64 if you don't yet have one.

Requires DS3231 or DS1307 RTC to be connected to C64 userport:

C64 UserPort Pin  Pin Name  DS1307 RTC pin
 1                GND       GND
 C                PB0       SDA
 D                PB1       SCL

Also the +5V needs to be connected.
User port pin 2 may not be able to provide enough current so, I don't recommend
using that so, you dont fry anything. Getting +5V directly from C64 PSU is propably always safer.
Module needs a battery backup. There are very cheap ready made modules which already have one
added, for example:

Tiny RTC DS1307:


Tiny RTC module

Note, that you may need to remove the pullup resistors (R2 and R3) from Tiny RTC DS1307
for proper operation. Also, the battery holder in my unit was not very good and
there was a risk of battery falling out or not having a proper contact.
I added just a bit of folded plastic to force the battery holder's "spring" - so, nothing difficult, really.
The board is designed to be used with rechargeable battery. However, it is recommended to use normal battery (CR1225) and disable the charging circuit by removing R4, R5, R6 and D1. And if there is a resistor installed in R7 - remove that as well.
Short R6, for example, by soldering a short wire between the pads.

DS3231 based RTC module

DS3231 based RTC module
In general this is probably the version you'll want to use. It is more accurate than DS1307 and also seems to be more reliable.
Just like Tiny RTC (DS1307) this board also is designed to be used with rechargeable battery.
It is recommended to use standard CR2032 instead and remove the charging diode.
DS3231 Charging Diode

Included programs (same SW for both DS1307 and DS3231):

Included native programs:

 - Fetches and shows date and time from DS3231
 - Updates basic TI$ variable with current time
 - Updates TOD with current time
 - Same as fetchrtc but also lets you change the date & time
 - version that is not crunched with exomizer.
   This leaves basic in better health after running the prg
 - version that is not crunched with exomizer.
  This leaves basic in better health after running the prg

Included GEOS programs:

 - C64 GEOS driver (auto-exec) which loads the time & date from DS1307 during GEOS boot and updates the C64
   registers so that GEOS gets the correct time

 - C64 GEOS utility for setting the correct date & time into DS1307 RTC.
   Setter uses the same input method as Maciej Witkowiak's DS12C887 utility

Installing and testing rtcgeosload.prg and setrtcgeos.prg:
 1. Copy these files into your GEOS boot floppy
 2. Load GEOS: load"geos",8,1
 3. Once GEOS has booted - use CONVERT utility to convert rtcgeosload.prg
    and setrtcgeos.prg into GEOS format.
 4. Now you can run "SetRTC" utility to set correct time & date.
 5. Return to basic and switch off C64 for a few seconds
 6. Switch on C64 and load GEOS
    --> After GEOS has booted, the correct time & date should show in upper right corner
Timo Voutilainen,
Sep 20, 2018, 7:38 AM
Timo Voutilainen,
Aug 21, 2014, 8:01 AM