A clock app for my Apple ][ clone in 6502 assembly, using interrupts generated by an inductive proximity sensor and a physical pendulum clock. I wanted to polish the code a bit more before sharing (I especially dislike the self modifying code part), but the computer seems to have developed a hardware problem lately and it keeps crashing (bad RAM chip most likely), so I am sharing as is.
Interesting idea to use an inductive sensor. I personally would have suggested a hall sensor (though that would involve fixing a tiny magnet to the pendulum) as the cheapest solution. But of course there are many ways to solve the same problem. Neat project, thanks for sharing!
The canonical way of using pendulums as time reference in electronic circuits, is to use magnetic pendulum coupled a special circuit (a bjt and an inductor) that would not only sense the pendulum but also reenergize it.
If you are curious about this sort of thing, look up master pendulum clocks. They were precision clocks that provided electric timing pulses to network of slave clocks or other uses. Afaik they were common in mid-20th century
Optical sensor would be the best option - both induction and hall effect will add a very tiny eddy current brake effect that will slow down the pendulum. Probably imperceptively, but it'll be there and will affect time keeping eventually.
Oh wow, he uses the 60hz signal from the video circuitry. That's way more convenient than a big wall clock ;) And he even uses the same interrupt gating idea for the interrupts by using the game port.
Wow, people are still working on the problem of the Apple II not having an RTC, in some shape? :)
Say, weren't there some issues with interrupts on the Apple II, due to both the 6502 as well as buggy ROMs? Basically, none of the I/O in the stock system with Apple parts used interrupts whatsoever. Not disks, not serial communication.
The problem with the original firmware was that its interrupt handler used a zero-page location to store the accumulator. AppleSoft BASIC uses the same zero-page location for its own use, which makes BASIC incompatible with interrupts.
Another problem was with in the original Apple IIe. Its firmware interrupt handler was not updated to handle the new auxiliary memory and 80-column video configurations.
ProDOS provided proper support for interrupts, even on older Apple IIs (needed for mouse-based GUI apps and realtime clocks), and the firmware was eventually updated in the IIc and Enhanced IIe.
Yeah I think nothing actually uses interrupts by default. But they're accessible through the expansion ports. Not sure what the problem would be though.
This is quite interesting; I've been reading up on PLL and chip design lately, as well as VCOs, TCXOs, etc.
And now I'm wondering how accurate someone could make a reference signal from a physical pendulum like this—or what strange quirks you could introduce into a system using such a 'weighty' clock source!
Many pendulum clocks are capable of well under 1 ppm accuracy, which is better than many quartz oscillators. Here is a tour of clock precision by orders of magnitude:
> The Shortt was the first clock to be a more accurate timekeeper than the Earth itself; it was used in 1926 to detect tiny seasonal changes in the Earth's rotation rate. Shortt clocks achieved accuracy of around a second per year
Neat project. But I want more pictures of the mechanical clock too. All I can see are the pendulum, weights and chain. I'm going to guess it is a German Hermle movement? Is that a custom made clock case?
Oh good point, I hadn't even considered posting a photo of the clock itself. I'll add a picture of it to the post later. But to answer you question: no custom made clock case. The wood you're seeing is the wall. And the clock is a Junghans (so indeed German), I would say midcentury modern? Almost identical to this model (found through Google Images) : https://a.1stdibscdn.com/archivesE/upload/1121189/f_13997072...
I am 46 and I don't hear it, not even when I am sitting right next to it. But others who I've show the computer to have noticed the noise as well, so I know it's there. I'm actually kinda happy about not hearing it myself :D