smart idea - using an RTC chip on the Spectrum
ZXNet echo conference «code.zx»
From Kirill Frolov → To All 12 February 2002
Press RESET immediately, All!
Sometimes in programs it is necessary to count time with discreteness less than 1
seconds.
The RTC chip only counts in seconds. Frame interrupts (20ms period) by
in any way
reasons are not sufficient (for example, the modem connected via Kondratieff is working
scheme
with interruptions -- frame interruptions are often lost). Can be programmed
A and B
RTC registers for receiving periodic interrupts with a period of 31.25ms. Themselves
interrupts
Of course, the processor will not receive it (on the spec, the RTC interrupt output of the chip is not
connected nowhere).
But it is possible during each hardware interrupt (NMI, INT from the modem...)
interrogate
RTC status register and detect the fact of an interrupt request. If nowhere with teams
DI interrupts
the program does not prohibit them, they (in the case of using a modem) do not occur
less often than
once every 20ms (NMI or INT). In short, every 20..40ms you can receive a pulse
to increase
time counter at 31.25ms, regardless of modem operation. Accuracy
counter depends
only on the accuracy of the RTC +/- 20ms.
* Originally in CODE.ZX
*Crossposted in REAL.SPECCY