Danny T said:
It listens to a pendulum clock ticking and measures the time between the
ticks and tocks. I've got it working pretty well right now. It's got
two LEDs that ping-pong in sync with the tick-tock for a visual
reference that it's working. It also prints the time between beats to
an LCD for balancing the beat. I'm going to have it calculate the
number of beats per hour to help speed up pendulum length adjustments.
I have one old clock that keeps time with an accuracy of a few seconds
per week. Not bad for something on the order of 125 years old, huh?
I'm going to solder it up and add support for an optical detector or
two. I'm basically making something similar to this: (not for sale,
just for me ;-)
http://www.bmumford.com/microset.html
I collect old clocks, most of which don't work when I get them,
otherwise I couldn't afford them. Proper tools are hard to come by and
usually quite expensive. Brian's device is quite sophisticated and well
worth what he wants for it, but it's too expensive and too much of a
luxury for my blood. I don't need all the features, just a couple would
be nice. The ability to count the beats in one revolution of the minute
hand would be a huge timesaver for fitting a new pendulum, that's where
the optical sensor comes in. You just let the clock tick off an hour
(takes about 5 minutes with no pendulum attached) while you count the
number of ticks (optically or acoustically). This gives you the beats
per hour for that particular movement (timepiece). You then fit a
pendulum and adjust it in real time while looking at a real time beats
per hour display. Finally, adjust the length until it's right on with
what was calculated earlier. A job that used to consume days of trial
and error tinkering can now be done way less than two hours.
You should check out the rest of his website as he has some interesting
information about timekeeping in general, including studies he did of AC
mains frequency accuracy.
I'm the same with software... I've written about 30,000 "personal"
websites, and none of them ever make it to the web, because by the time
I've finished, I've thought of a better way to do it... It's good for
learning, but gets me a reputation!! I've decided if I can do this clock
properly (replace these 4 pics with cheap shift registers or something)
with alarm, I might start using it - just because I can!
Yeah, it's kinda neat to actually be able to use your projects.
I meant in a more general sense. From looking at shift registers, they
seemed to have clock and latch - clock seemed to be to set data (for
serial use), and latch was to move the collected input to the output
pins... I guess mine's a combi!
From the receiving point of view, CLOCK tells you when to look at the
data line for valid information. You could think of your RB5 pin as a
latch pin since it tells the slave pick when to capture the information.
Hmmm, I wasn't aware of this - and everything seems to work without a
resistor. What are the implications - what difference would I see in
high/low with and without an external resistor?
Without the pull-up resistor, the pin can't actively drive anything.
IOW, it can't put out +5V. It can only act as a current sink. It may
be that the segment you have it connected to doesn't draw any
significant current (very likely) and that the pin floats high enough to
make it happy. It would never be able to supply enough +5V juice to
turn on an LED.
As well as holding the "enable" pin for 10 cycles, to be safe (if it
where 10), I'd also have to hold the "enable" pin low while maintaining
the same data to be "safe". Imagine if I hold the enable pin high for
100 cycles, we know my chip has read the data successfully, so I then
drop *all* pins down to 0. Since my "shift register" is running very
quickly, all it takes is for this moment (when all pins go low) to be
between the "is enable pin high" and "move input to output" and 0h would
be copied to my output!
Does that make sense?
Yes, that's why you need a data hold time. This is the time spent
continuing to present valid data on the port even after you bring the
enable pin low. As long as it's a predictable value, the slave PIC can
safely accept data from the master without worry. You'll see this value
specified in applicable datasheets where data is being exchanged via
I2C, SPI, etc...