Quick RTC question

230 views
Skip to first unread message

Pellatonian

unread,
Jun 19, 2021, 7:03:35 AM6/19/21
to RC2014-Z80
Is there a real time clock kit which would generate a regular timed interrupt and is supported by RomWBW for an RC2014 Pro? I'm interested in the timed interrupt rather than the dayclock feature in this case.

Thanks for any information on this.

Steve.

Justin Skists

unread,
Jun 19, 2021, 8:24:57 AM6/19/21
to RC2014-Z80
The SC102, using a Z80 CTC, from Stephen Cousins is the closest official kit to give a regular timed interrupt, that I know of. But your system will need to work in conjuction with a daisy chained Interrupt Mode 2. (probably not much of an issue if its the only IM2 device on the bus).

I don't know if its supported by romwbw, itself, out of the box, though.

I hope that helps,
Justin.

Alan Cox

unread,
Jun 19, 2021, 8:35:46 AM6/19/21
to rc201...@googlegroups.com
On Sat, 19 Jun 2021 at 12:03, Pellatonian <pella...@gmail.com> wrote:
Is there a real time clock kit which would generate a regular timed interrupt and is supported by RomWBW for an RC2014 Pro? I'm interested in the timed interrupt rather than the dayclock feature in this case.

It does not.

There are two standard sources of interval timers for RC2014 systems

- The TMS9918A card can be jumpered to provide a vertical blank (pedantically speaking it interrupts bottom of displayed pixels) which gives you a 60Hz timer
- The Z80CTC cards can provider a timer interrupt but because the CTC expects to be used in IM2 which standard RC2014 does not support it's slightly ugly to set up

And the following less standard cards also provide one
- QUART
- Both of the 2681 derived dual serial cards (XR88C81, 26C92)
- 82C54
- 6522 VIA (but not for Z80 style systems)

The CTC is probably the most flexible. The problem is that there is no direct way to identify the CTC as an interrupt source. What I do in Fuzix therefore is to chain my timer counter with a second one. When I get the interrupt off the first the second tells me how many events I got. The only other gotcha because of the lack of IM2 support is that you must configure all the devices that will assert IM2 vectors to produce the same value or not respond or they will fight on the bus.

If you have an IM2 capable backplane such as the ones from Small Computer Central you can set up the SIO and CTC with IM2 and IEI/IEO chained and it all works as Zilog intended. If you do this and you want to support any non IM2 capable device as an interrupt source you'll run into problems though.

Another trick and one I use with things like Toms SBC and the Retrobrew design that lack an interval timer is to just run an externally generated 8Hz clock into one of the spare modem pins, then use the UART as an interrupt controller. All you need is a can oscillator and a counter. Making an actual interval timer card is slightly more complicated because you need to add an address decoder and a way to generate the IRQ and also be able to read/reset the interrupt event. Still wouldn't be that hard a project.

Alan

Steve Cousins

unread,
Jun 19, 2021, 9:16:26 AM6/19/21
to RC2014-Z80
If the only interrupt generating devices in your system are the serial (SIO) and the timer (CTC) then you can avoid the interrupt daisy-chain issue by using SC110. SC110 includes both the SIO and the CTC so the interrupt daisy-chain is included on the circuit board. I've not checked, but I think RomWBW supports this setup for generating a clock tick interrupt. The CTC also gives you software control of the baud rate for serial port B. There is a spare CTC input that could, in theory, be used to trigger a mode 2 interrupt from a non-Z80 family device. SC110 does not link two channels in the way Alan describes for FUZIX but that may not be an issue for RomWBW. You could modify SC110 to achieve this if required.

Expanded systems with multiple interrupt sources are a bit of a problem with RC2014 as official systems do not support a mode 2 daisy-chain. In fact, with mode 2 interrupts, the official SIO assumes it is the only interrupt generating device and does not provide any access to the daisy-chain signals.

Steve

Pellatonian

unread,
Jun 19, 2021, 9:42:23 AM6/19/21
to RC2014-Z80
Thanks everybody for the advice.

Steve: At present I have all interrupts in the RomWBW config turned off in the RC2014 PRO (don't like the SIO handling). I could reinstate interrupts in general in the RomWBW config but turn them off in the SIO code so that the SC110 would be the only interrupting device. 

Do you think that would have a chance of working?

Steve Cousins

unread,
Jun 19, 2021, 6:28:29 PM6/19/21
to RC2014-Z80
I don't know my way around RomWBW well enough to be confident, but I think so.

If you are only going to have interrupts enabled for the CTC you could probably just add a CTC module (SC102) to your current setup to generate the timer tick interrupt. SC102 is very flexible and can be configured with jumpers to do most things you can dream up with a CTC.

The advantage of SC110 is that you can have interrupts enabled for both CTC and SIO without having to deal with the interrupt daisy-chain (it is all on the SC110 module). SC110 would replace your existing SIO module.

Steve

Wayne Warthen

unread,
Jun 20, 2021, 11:30:44 PM6/20/21
to RC2014-Z80
On Saturday, June 19, 2021 at 6:42:23 AM UTC-7 Pellatonian wrote:
Thanks everybody for the advice.

Steve: At present I have all interrupts in the RomWBW config turned off in the RC2014 PRO (don't like the SIO handling). I could reinstate interrupts in general in the RomWBW config but turn them off in the SIO code so that the SC110 would be the only interrupting device. 

Do you think that would have a chance of working?

This is definitely possible in RomWBW.  However, you will need to make some minor code changes in the SIO driver to disable it's interrupt handling even when interrupts are enabled in general.  I agree with Steve, that it would be easiest to just leave the RomWBW SIO code alone and use the SC110 such that you are getting both SIO and CTC interrupts.

-Wayne
 
Reply all
Reply to author
Forward
0 new messages