DS1302 Real Time Clock

590 views
Skip to first unread message

Ed Brindley

unread,
Feb 3, 2018, 4:07:20 AM2/3/18
to RC2014-Z80
Hey all,

I developed a DS1302 real time clock board, primarily for use with RomWBW.

The Kicad project is on GitHub here, including gerbers etc so you can get your own boards made if you like: https://github.com/electrified/rc2014-ds1302-rtc

The schematic is here: https://github.com/electrified/rc2014-ds1302-rtc/blob/master/rc2014-ds1302-rtc.pdf

I've also put some of the boards on Tindie: https://www.tindie.com/products/edbrindley/real-time-clock-pcb-for-the-rc2014-computer/

There is some chat about it in this thread from when Colin discovered the RomWBW support :): https://groups.google.com/forum/#!topic/rc2014-z80/twPWj1LPWzM

Cheers,
Ed

Marco Maccaferri

unread,
Feb 16, 2018, 10:52:44 AM2/16/18
to rc201...@googlegroups.com
Il 03/02/2018 10:07, Ed Brindley ha scritto:

> I developed a DS1302 real time clock board, primarily for use with RomWBW.

I just finished to build the board, works perfectly! I don't have RomWBW
so I had to modify the RTC program so it defaults to RC2014 when it
doesn't detect a known bios.

Is it correct that RTC.asm is the only program available for the
realtime clock board ?

I already wrote a DATE program that just returns the date and time, I
want make it a bit more complete.


Jay Cotton

unread,
Feb 16, 2018, 2:07:51 PM2/16/18
to RC2014-Z80
Just got the parts, till waiting for the board....  
Marco can you share your work?  I'd like to quick start the s/w 
in order to have a test program.

tnx

jc

Marco Maccaferri

unread,
Feb 16, 2018, 3:53:29 PM2/16/18
to rc201...@googlegroups.com
Il 16/02/2018 20:07, Jay Cotton ha scritto:

> Just got the parts, till waiting for the board....
> Marco can you share your work? I'd like to quick start the s/w
> in order to have a test program.

Sure, in the attached zip you can find the modified RTC.ASM program and
the precompiled binary ready to be uploaded.
RTC.ZIP

Jay Cotton

unread,
Feb 16, 2018, 4:12:07 PM2/16/18
to RC2014-Z80
Thanks!


On Saturday, February 3, 2018 at 1:07:20 AM UTC-8, Ed Brindley wrote:

Ed Brindley

unread,
Feb 18, 2018, 6:05:36 PM2/18/18
to RC2014-Z80
Hi Marco!

Glad you've got the board up and running :)

Yes, to my knowledge RTC.asm is the only stand-alone program that makes use of the clock so far.

These is also the in-BIOS code that the ZSDOS td/ldds commands interface with. If you were wanting to implement your own program it might be a better place to start as the code is more readable! https://github.com/wwarthen/RomWBW/blob/master/Source/HBIOS/dsrtc.asm

Colin Little

unread,
Feb 19, 2018, 7:31:28 AM2/19/18
to RC2014-Z80

Just for fun and to learn a bit more programming (with the RTC.) !!! I wrote this in XYBASIC. It just uses ZSDOS function 98 (Get time & date). I also wrote a similar program using BBCBASIC. 



OK
LIST
30 POKE #4000, #0E
40 POKE #4001, #62
50 POKE #4002, #11
60 POKE #4003, #82
70 POKE #4004, #40
80 POKE #4005, #CD
90 POKE #4006, #05
100 POKE #4007, 0
110 POKE #4008, #C9
120 CALL #4000
130 FOR TIM = #4082 TO #4086
140 ADR = PEEK(TIM)
150 REM PRINT BIN(ADR);
160 NEXT TIM
170 YR = BIN(PEEK(#4082))
180 YEAR = YR+2000
190 MN = BIN(PEEK(#4083))
200 DATE = BIN(PEEK(#4084))
210 HOUR = BIN(PEEK(#4085))
220 MNT = BIN(PEEK(#4086))
230 PRINT DATE;"/";MN;"/";YEAR
240 PRINT HOUR;":";MNT

run
 19 / 2 / 2018
 12 : 31

Jay Cotton

unread,
Feb 20, 2018, 9:13:26 PM2/20/18
to RC2014-Z80
another clock up and running.

Ed:  a small mod to the board would make it multi purpose.   Add a 4pin header to allow off board i2c buss connections....
gnd, vcc, clock, data.   

jc


On Saturday, February 3, 2018 at 1:07:20 AM UTC-8, Ed Brindley wrote:

Ed Brindley

unread,
Feb 21, 2018, 12:32:35 PM2/21/18
to RC2014-Z80
Hi Jay,

Glad to hear you're up and running!

Good suggestion there of adding a pinout for the 3 wire serial.

Cheers,
Ed

Marco Maccaferri

unread,
Feb 26, 2018, 3:27:15 AM2/26/18
to rc201...@googlegroups.com
Hi,

I wrote a simple NTP client to synchronize the RTC clock using an ESP-01
module connected to the secondary SIO port. The code RTCNTP is on my
Github repository:

https://github.com/maccasoft/z80-apps

As of now it doesn't support timezones or dst switch, but can be
modified and recompiled directly on the RC2014 with the standard CP/M
ASM and LOAD utilities.

The program assumes that the ESP-01 is already connected to an access
point and to make things a bit easier a wrote a very dumb terminal
utility TERM to allow configuring it (or anything else connected to the
secondary SIO port).

Enjoy!
Message has been deleted

Mark Pepper

unread,
Nov 1, 2018, 8:23:44 PM11/1/18
to RC2014-Z80
Hi

I'm afraid I cant get my RTC working. If I boot with a RomWBW with RTC (3.512K) built in it takes ages to start up and in Zsystem LDDS/TD says that no clock module is installed. If I boot with a RomWBW image without RTC built in (1.512K for example), run Zsystem, running LLDS causes a PANIC and crash.

Any thoughts on where to fault find before I break out the scope?

Regards
Mark

Jay Cotton

unread,
Nov 1, 2018, 11:59:13 PM11/1/18
to RC2014-Z80
You might need to compile romwbw with rtc enabled.
Reply all
Reply to author
Forward
0 new messages