Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion LCD controlling with comparators
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Danny T  
View profile  
 More options Jan 16 2005, 8:36 am
Newsgroups: sci.electronics.basics
From: Danny T <da...@nospam.oops>
Date: Sun, 16 Jan 2005 13:36:37 +0000
Local: Sun, Jan 16 2005 8:36 am
Subject: Re: LCD controlling with comparators

Anthony Fremont wrote:
> Don't forget the caps to ground, or it wont start.  It's only recently
> that I started using the internal osc.  It's actually getting to be
> fairly usable as the new parts come along.  A 16F628 I'm playing with
> right now is only fast by about 3.5% according to my 15 year old
> frequency counter.  This is actually convenient for me since I can use
> Timer0 with a prescaler of 4 and get interrupts at almost exactly 1mS
> intervals (instead of 1.024mS) without having to reload it every
> interrupt.

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

> Well, it's not quite that straightforward.  You usually count a bunch of
> short intervals (like milliseconds) and then do something important when
> 1000 have gone by.  A common housekeeping interrupt loop time is 10mS.
> Every 100 interrupts you could add one to a seconds counter.  Timer2 is
> real good at this kind of stuff, but I like to use it for other things.
> Timer0 is kinda weak (only 8 bits), but it's handy.  ;-)

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

>>Btw, is 4Mhz 4 million instructions per second? Guess I need to make

> No, it's 1 million instructions per second.  The clock is divided by 4
> as every instruction cycle consists of 4 Q states.  4MHz is a nice clock
> speed because every (single cycle) instruction takes 1uS to execute.

Right, even easier to remember! :-)

> When an interrupt occurs, the GIE flag is cleared.  This prevents the
> scenario you described.  When the ISR returns, it uses a retfie
> instruction which sets the GIE bit again so that another interrupt can
> occur.  If you forget to clear the flag for the interrupt that you just
> processed, then you'll be processing it again as soon as you execute the
> retfie.  ;-)  This is a common mistake for newbies.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.