LCD controlling with comparators

Yep, I just popped out to get caps, realising I didn't have any small enough... Those I came back with (a lucky bag!) include 10pF and some that I believe are 15pF (they're brown, unlike most of my small blue ones!) and have "15J" written on them. The datasheet says 15pF are fine, though that's not optimised, and I've seen other quotes of 10pF. If the datasheet isn't clear, how am I supposed to know which is best?

And while we're on the subject, can someone please explain capacitors to me... I've been reading The Art of Electronics, and gotten confused. As I understood (before and after reading), caps hold charge (like a buffer?)... I guessed that the cap recommended across Vdd and Vss on my pic just "swallowed" up any little spikes, and sent them back to ground, rather than through the pic. What would a cap on each leg of the crystal do - to me, it looks like the whole thing would just go to ground (They're very very small caps!) and the pin would see hardly anything? Do I misunderstand? :(

Sounds fair enough - my only worry now, is getting into the realms of "threading"... Like the "random" failure I described before - not having anything in my code assuming a register x instructions further up holds the same value, since an interrupt may have fired in between and changed it!!

Right, even easier to remember! :-)

I read about that... I'm sure I won't make that mistake... (well, I won't post it here when I do, at least ;-))

--
Danny
Reply to
Danny T
Loading thread data ...

And this:

formatting link

A talking clock!! ;-)

--
Danny
Reply to
Danny T

Well, I've gotten stuck already... Posted in alt.microsomething.8bit (TB usefully says a.m.8bit) if you'd care to look :-(

--
Danny
Reply to
Danny T

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 ;-)

formatting link
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.

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...

Reply to
Anthony Fremont

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 :-)

--
Danny
Reply to
Danny T

recently

with

use

1mS

fine,

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.

4

clock

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. ;-)

Reply to
Anthony Fremont

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 :(

--
Danny
Reply to
Danny T

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.2

Nice 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?)

--
Danny
Reply to
Danny T

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.

Reply to
Anthony Fremont

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?

--
Danny
Reply to
Danny T

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.

Reply to
Anthony Fremont

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.

Reply to
Anthony Fremont

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).

Reply to
Anthony Fremont

I see. I'll leave bi-directional stuff for now ;-)

--
Danny
Reply to
Danny T

*the*? Do you just mean one of them? ;P

Righto :-)

--
Danny
Reply to
Danny T

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 ;-)

--
Danny
Reply to
Danny T

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! :-)

--
Danny
Reply to
Danny T

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.