And this:
A talking clock!! ;-)
And this:
A talking clock!! ;-)
Well, I've gotten stuck already... Posted in alt.microsomething.8bit (TB usefully says a.m.8bit) if you'd care to look :-(
them
to
since
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 ;-)
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.
time
clock
something)
Yeah, it's kinda neat to actually be able to use your projects.
or
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.
as
output
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.
at
have
maintaining
would
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...
Sounds interesting, though I'm an 80s child, so I'd probably rig the clock to be controlled by something digital and leave the pendulum for show ;-)
I see - so if I noticed the segments attached to those pins didn't light, putting a resistor between 5V and the pins would correct it?
What would be the correct (or possible) ways to attach an LED to this port? Would it just a resistor from +5V to the pin, connected to the LED, or would it make more sense to attach the LED from +5V to the pin, and let it sink? Does the chip need to be told if it's sinking or sourcing, since I imagine they'd need to be hooked up rather differently?
Excellent, I was worried the electronics world was pumping out dodgey electronics for a while then! Though I do find it strange this value is specified, rather than the "reading" component reading data off into a buffer, then processing from there - this way it's always perfect. We only update *if* the clock is on, with the data we *know* was present with the clock :-)
recently
with
use
1mSfine,
the
The ones that are best will be the ones that make your crystal oscillate at exactly the right frequency, and start-up every time you apply power. ;-) You will probably want to use two 22pF ceramic caps.
to
As
my
ground,
crystal
Very small caps are best at passing thru only the highest freqencies. Glitches on the power line are usually at quite high frequencies. And yes some of your oscillator is being leaked to ground. It's ok, otherwise the crystal might fracture under the stress of too much feedback.
bunch of
when
10mS.is
things.
having
holds
changed
Well, the interrupt routine must not save and restore the W, STATUS and possibly FSR and PCLATH when it executes. Otherwise things go to pieces in a big hurry. Preventing "collisions" between the ISR and main level is not that hard.
4clock
the
can
just
the
Yeah you will, you just won't know that's what's happening. You will be certain that the processor is not executing instructions properly. ;-)
Grrr...!
*looks in bag*Why the hell can't they label caps properly?! My 100n caps are labelled "10", and the 1u are labelled "105"... Is there a nice big table somewhere that'll tell me all the possible things 22pF caps could be labelled as? (and why did you say 22?)
Right :)
Check my code in a.m.8bit - doesn't seem to work :-(
I'm certain it's not, but I am using RETFIE and clearing my interrupt flag first :(
I was wrong, they're 104 (100n) and 105 (1u). Those marked 10 are 10pF. I *think* those marked 15J are 15pF. I've also got them marked...
102J COG63 6n8S 8 33n 33n 47nS 32V n56 68j 8.2Nice and consistant :(
Btw, you said the best ones makr my crystal accurate - does this mean if my clock loses time, I need to change the caps? Can you tell which direction? (eg. if my clock loses a minute a day, what do I do?)
the
got
to
adjustments.
seconds
I always wanted to put a pic, a lithium battery, a hall sensor (or MEMS accelerometer to be really cool) and a column of LEDs into a pendulum bob. Then the swinging column of LEDs could strobe out the date/time in a format suitable for people that have problems with analog dials and hands. ;-) I really have to get this done.
may
enough to
Yes, you would pick your resistor size so that enough current could be supplied to the device being switched on and off.
pin,
differently?
You can do it either way you prefer. Many CMOS parts are better at sinking current than sourcing it, but the PICs have the same limit either way (usually 25mA per pin)
When the PIC is outputing a 0, then it is actively driving the pin low and can sink current. When it is outputing a 1, it is actively driving the pin high (except RA4) and can source current. If you hook two PICs together and try to have a dualing outputs contest, one of the pins will not survive. Always use a current limiting resistor between pins that might try to do this.
the
can
value
is
The hold time is just to give the receiving device enough time to detect the clock and get the data. The data is held on the output device for a small (but specified) period of time so that the window of opportunity that you are concerned about gets closed.
Sounds like fun! Just make sure you're not posessed to get Blue LEDs... Can we say tacky? :-)
I believe one resistor would do all the pins.. I'm not sure how that would work though, given I'd end up with different currents depending on how many pins where high/low!
Do you mean having the output of a pic fed to the input of another? Like I need for my clock? Should I put resistors between them?
Oh, and each output from my "driver" is connected to 4 inputs (one from each of the other pics) - anything I should be careful of there - 4 inputs probably draw 4 times as much current - is there a problem here?
oscillate
power.
labelled
They usually have the cryptic value of "22" printed on them, plus the size is kind of a giveaway. ;-) I said 22, because that's what I've always used and it works. But a better reason would be that the datasheet calls for 15 to 33pF of capactance for each cap. The real determining factor is whatever the crystal manufacturer calls for to bring the crystal to the right frequency. 22pF works pretty well in practice. It's only really critical when you are trying to keep precision time over a long period.
freqencies.
And
and
pieces
level
Check my reply, you need to make changes. ;-)
will be
;-)
Your code looks ok in this respect.
MEMS
pendulum
date/time in
and
LEDs...
be
on
You only have to worry about pin RA4, the others are fine.
low
driving
PICs
will
that
Like
It wouldn't hurt for you to do that (1k should work fine), but it's important when you have pins that flip from being input to output on the fly when trying to communicate bidirectionally. Eventually something leads to things being out of sync and then you have battling outputs. When one pin is *outputting* a 1 and the the other is *outputting* a 0, it's a short circuit.
from
here?
CMOS inputs draw very miniscule amounts of current, almost 0.
10pF.
if
If your clock was losing a minute per day, then you would likely need to fix the bug in your code. ;-) If, however, the crystal was running slow and you were losing a few seconds per day, that would mean you have too much capacitance. IOW, the bigger the caps the slower the crystal will run (to a point).
I see. I'll leave bi-directional stuff for now ;-)
*the*? Do you just mean one of them? ;P
Righto :-)
That's fine then... If, over a year, I start getting into work later and later, I think I can live with that :-)
What did you say - bigger caps mean work later? ;)
Thanks, but I've managed to still do it wrong 0:-)
You're likely reading it wrong ;-)
Righto. I'll leave it as it is while I get my other chip working, then I might play about with changing it as you suggest! :-)
Have something to add? Share your thoughts — no account required.
Ask the community — no account required