Searching \ for '[PIC] Stupid Question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Stupid Question'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Stupid Question'
2002\09\24@175529 by Jinx

face picon face
> I am new to this. I was wondering for this beginner circuit:
>
> http://www.piclist.com/techref/piclist/cheapic/bincnt.htm
>
> does the C = 33pf designate a Crystal? if not, if it is a capacitor then I
> am confused by the drawing because it says 32.768 kHz but does not
> show an icon for the crystal

It does - the drawing could have been spread out a little more. A 32k
crystal with two 33pF caps is shown. Really

> Which leads me to a generic question. When designing a circuit how
> do you choose which crystal to use? do all projects use the same
> generally?

"all" and "generally" don't go together. The first consideration is
probably speed. What do you want the micro to do, and how fast
does it need to do it. But crystal speed isn't always reflected in the
price. Common fast crystals may be be cheaper than uncommon
slow crystals. 32k is pretty cheap, so are 4MHz, 10MHz and 20MHz
so you havve that to consider as well. Then there's accuracy. Can you
use a ceramic resonator (often cheaper than a crystal and may have
built-in capacitors) even though it's not as accurate ? Size isn't an
issue in most circuits

For "general" work, you'd probably go with 4, 10 or 20MHz, depending
of course on the speed rating of the micro. It's like the choice of
"general" resistors. Everyone reaches for 1k, 4k7 and 10k when you
need "a" resistor

Specialised operations call for more thought. For example, if you need
RS232 data comms with the micro, then a hexadecimal value crystal,
eg 3.6864MHz, is easier to work with than a decimal value (eg 4, 10,
20MHz) because of the binary nature of the micro. However, if you wanted
time delays or pulses that were exact multiples of say 10 microseconds,
then a decimal crystal is more suitable

> Also, what other components need to be ordered (like 5v regulator, etc).
> I am going to make an order to digikey and I dont want to get the stuff
and
> realize I have to place a whole other order becasue I forgot some stupid
> support component

Regulators - 7805 (1.5A), 78L05 (100mA), LP2950 (low power, good for
using the micro on battery power)

Small transformer or plug-pack (wall wart), eg 6V, 12V

A few 470R, 1k, 10k, 100k resistors, 10n caps, 10uF caps, 18 pin sockets,
LEDs, small transistors (eg BC548, 2N3904, BC337) for switching relays
etc, push-button switches, DC connector (for wall wart), toggle switch
(power
on/off), battery clips, would cover the basics

You can look around for discarded circuit boards and envulturate many
many components off them. Doing this can save you particularly on hard-
ware like switches, LEDs, LCDs, connectors, capacitors, hook-up wire,
some exotic parts. You'd be surprised what ends up in rubbish bins. One
thrown-out VCR would keep you in basic parts for a while. Get cheeky
and ask at a repair shop, they'll more than likely let you rummage

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@182858 by Matt Johnson

flavicon
face
Jinx,

Holy cow! Thanks a lot this is everything I wanted to know and more. I
didnt know any of that about the crystals. I have a couple questions
related to that.

1. Does the code syntax change depending on the crystal speed? it seems
like if it didnt why wouldnt you just always use the fastest one, the
price differences seem minimal.

2. Are there any internet resources that explain more about a hexadecimal
value crystal vs. a decimal value crystal? I have a problem understand how
a crystal that emits frequencies would have anything to do with binary or
decimal, I would like to know more about that.

3. Ceramic Resonators, I imagine when you talk about accuracy you are
referring to the fact that a clock cycle varies in the time it execute? so
basically this only matters when you need accuracy within milliseconds and
consistantly correct?

BTW, I have been considering if I should get into the PICs or the AVRs,
and from my initial emails it appears that I get a lot more support from
the PIC users than the AVR. I wonder why if the AVR's are faster and
'better' overall why the support base is so skewed towards PIC users...

- Matt


On Wed, 25 Sep 2002, Jinx wrote:

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@190436 by Pic Mailingliste

picon face
MJ> 1. Does the code syntax change depending on the crystal speed? it seems
MJ> like if it didnt why wouldnt you just always use the fastest one, the
MJ> price differences seem minimal.

Well imagine a loop like

    for(i=0;i<=1000;i++)
    {
    }

It's execution-time depends directly to the crystal speed ... it's the
same for timer-interrupt-routines ... so changing the crystal means
rethinking the code for time-loops that will change.

Changing the crystal-speed changes the power consumption of the pic
... again a look into the pic 16f84 datasheet would be very helpfull.

MJ> 2. Are there any internet resources that explain more about a hexadecimal
MJ> value crystal vs. a decimal value crystal? I have a problem understand how
MJ> a crystal that emits frequencies would have anything to do with binary or
MJ> decimal, I would like to know more about that.

What Jinx tried to explain is, that a decision for a certain
crystal-speed can be made by the needs of you project. If your project
requires a certain delay-time you could calculate the a easy to use
crystal.

e.g. you want a delay-loop that counts up to 1000 within 1 ms. To
reach this you could use a 4 MHz crystal,since the Pic divides the
clock speed by 4 so you get 1 MHz internal clock speed which means 15s
for a clock-cycle, so that 1000 clock-cycles give you 1ms delay.

MJ> 3. Ceramic Resonators, I imagine when you talk about accuracy you are
MJ> referring to the fact that a clock cycle varies in the time it execute? so
MJ> basically this only matters when you need accuracy within milliseconds and
MJ> consistantly correct?

imho ... yes

MJ> BTW, I have been considering if I should get into the PICs or the AVRs,
MJ> and from my initial emails it appears that I get a lot more support from
MJ> the PIC users than the AVR. I wonder why if the AVR's are faster and
MJ> 'better' overall why the support base is so skewed towards PIC users...

There are some differences and advantages / disadvantages for those
two families which have been discussed some weeks ago on the list ...
have a look at the archive ..

You're right the support for the AVRs is much worse than the support
for the PIC ... but I've no idea why ...

Greets,
      Michael


p.s.: Get the datasheet for the IC you want to work with and read it,
     this will solve lots of your questions ;-)

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@194456 by llile

flavicon
face
Matt Wrote:
>BTW, I have been considering if I should get into the PICs or the AVRs,
and from my initial emails it appears that I get a lot more support from
the PIC users than the AVR. I wonder why if the AVR's are faster and
'better' overall why the support base is so skewed towards PIC users...

- Matt

It's like the old race between the PC and the Mac.  Mac's have always been
faster and easier to use right out of the gate until today, yet the PC
wins more business because of support and documentation and user
community.  Likewise with the PIC.  If you want cheap, the PIC is king of
cheap, and that is number one in my specialty.  If you want powerful,
PIC's can get pretty powerful but there a lot of other processors better
at it.  But if you want support, and a broad community of support, ten
different correct answers for every question kind of support, then this is
the place and PICs are the processor.  If you can't find the answer on the
PIClist then the question probably was not about electronics (or physics
or cows or hydrogen powered cars or Armadillo Aerospace or differences
between Aussie and American English).


-- Lawrence Lile
Senior Project Engineer
Toastmaster, Inc.
Division of Salton, Inc.
573-446-5661 voice
573-446-5676 fax

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@194508 by Herbert Graf

flavicon
face
> 1. Does the code syntax change depending on the crystal speed? it seems
> like if it didnt why wouldnt you just always use the fastest one, the
> price differences seem minimal.

       Code syntax? No, code content? Yes, delay loops have to be changed, along
with r-m-w problems that creep up at higher speeds.
       Lower speeds have their benefits, power being the biggest. In a battery
environment you often go as slow as possible to save power. There are other
factors as well.

> 2. Are there any internet resources that explain more about a hexadecimal
> value crystal vs. a decimal value crystal? I have a problem understand how
> a crystal that emits frequencies would have anything to do with binary or
> decimal, I would like to know more about that.

       As described a hex crystal is only one with a frequency that can easily be
divided wholy. This is important if you want to use serial comms or
something having to do with time, otherwise it isn't as important.

> 3. Ceramic Resonators, I imagine when you talk about accuracy you are
> referring to the fact that a clock cycle varies in the time it execute? so
> basically this only matters when you need accuracy within milliseconds and
> consistantly correct?

       Yes, you really only have to worry about oscillator accuracy when you need
something to be very precise, usually when doing something over a long
period of time. Even serial comms can tolerate a surprising amount of
inaccuracy and still function perfectly.

> BTW, I have been considering if I should get into the PICs or the AVRs,
> and from my initial emails it appears that I get a lot more support from
> the PIC users than the AVR. I wonder why if the AVR's are faster and
> 'better' overall why the support base is so skewed towards PIC users...

       AVRs aren't "better" overall, they are "better" in some cases, as PICs are
"better" in other cases. From a pure hobbiest begginer with no prior
experience POV I'd recommend PICs since there is so much support, both from
users AND the manufacturers (Microchip is suprisingly supportive of
hobbiests, at least compared to other MCU manufacturers). OTOH an AVR would
probably be better for a beginer who has had experience with the Intel or
Motorolla based MCUs in the past since AVRs are much closer to that
architecture then PICs are. In fact PICs are pretty weird at first glance,
but after you get used to it there are some nice benefits with the PIC
approach. Just my opinion. TTYL

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@210210 by mpoulton

flavicon
face
---- Original message ----
>Date: Tue, 24 Sep 2002 15:05:13 -0700
>From: Matt Johnson <spam_OUTmattTakeThisOuTspamALTAPACIFIC.COM>
>Subject: Re: [PIC] Stupid Question
>To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
>
>Jinx,
>
>Holy cow! Thanks a lot this is everything I wanted to know
and more. I
>didnt know any of that about the crystals. I have a couple
questions
>related to that.
>
>1. Does the code syntax change depending on the crystal
speed? it seems
>like if it didnt why wouldnt you just always use the
fastest one, the
>price differences seem minimal.

Only the timing of the execution of the code changes when
you change oscillator speeds.  If your code includes
anything time-related (which it almost certainly would),
then it would need altered to reflect the new oscillator
speed.  Peripheral devices (A/D converters, watchdog timer,
etc.) do not usually use the same clock, and their timing
may not be affected.  In this case, more drastic code
changes may be needed to accomodate these devices at a
different oscillator frequency.

>2. Are there any internet resources that explain more about
a hexadecimal
>value crystal vs. a decimal value crystal? I have a problem
understand how
>a crystal that emits frequencies would have anything to do
with binary or
>decimal, I would like to know more about that.

Serial communications (and many other functions) must occur
at certain time intervals.  Timing with microprocessor code
is quantized -- you have to work in multiples of the clock
period (or 4X the clock period, for PICs).  Therefore, if
you want to do serial communications at a certain speed, it
is easiest to choose an oscillator with a frequency that is
an even multiple of the communications data rate.

>3. Ceramic Resonators, I imagine when you talk about
accuracy you are
>referring to the fact that a clock cycle varies in the time
it execute? so
>basically this only matters when you need accuracy within
milliseconds and
>consistantly correct?

Accuracy is specified as a percentage, and exactly what time
error that turns out to be depends on the interval.  For
example, a 10% error on a 100ms interval is 10ms.  On a 1
day interval, it's 2.4 hours.  Accuracy varies not only from
resonator to resonator, but also with temperature and
possibly other variables for a given resonator.  If your
application is time critical, you will need to determine how
much clock frequency error is allowable and under what
circumstances -- then you can choose a clock source.

>BTW, I have been considering if I should get into the PICs
or the AVRs,
>and from my initial emails it appears that I get a lot more
support from
>the PIC users than the AVR. I wonder why if the AVR's are
faster and
>'better' overall why the support base is so skewed towards
PIC users...

PICs are more common and there are more development tools
for them.  I get the impression that microchip is
friendlier, if that matters.  AVRs are overkill for most
applications -- if a PIC works, why bother with something
more powerful?
--
Mike P.
MTP Technologies
KC0LLX

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\24@222840 by Jinx

face picon face
> 1. Does the code syntax change depending on the crystal speed?

No, only the execution speed changes. But you may have to
alter code that interfaces to external components to suit their
timing requirements, particularly in analogue circuits

> it seems like if it didnt why wouldn't you just always use the fastest
> one, the price differences seem minimal

I'll give you a specific example of why that doesn't always work out

I've got a circuit with 4 x 16F628 on it. One is running at 3.6864MHz
to do serial 19k2 comms to external devices. The other 3 run at
18.432MHz. They have jobs to do that requires speed. However,
the 3.6864 PIC also sends data to the other 3 by simple one-way
bit-banging (a two-wire clock/data system). As it's running at exactly
1/5th of the speed of the others, it means that the fast PICs have
plenty of time to reliably pick up the data without handshaking (which
can take an extra pin / time / code)

> 2. Are there any internet resources that explain more about a
> hexadecimal value crystal vs. a decimal value crystal? I have a
> problem understand how a crystal that emits frequencies would
> have anything to do with binary or decimal, I would like to know
> more about that.

It's not the crystal itself, it's the mathematics of its frequency. If you
wanted instruction cycles (IC) of exactly 1 microsecond, then a 4MHz
crystal is what you want to use. In my example above, 3.6864MHz
is an IC of 1.085us. But absolute timing isn't what I'm after - it's
serial comms timing that matters, and generally externally-set comms
timing (from eg 9600 baud, 19200 baud from a PC) is based on
hexadecimal timing. The 18.432MHz PICs in my example could be
run at 20MHz, but I just happen to have got a load of 18.432MHz
crystals at a clearance price

> 3. Ceramic Resonators, I imagine when you talk about accuracy
> you are referring to the fact that a clock cycle varies in the time
> it execute? so basically this only matters when you need accuracy
> within milliseconds and consistantly correct?

That's about it, although ceramic resonators are normally pretty
close to the marked value and not really that bad. They are more
likely to drift in frequency than crystals though

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\26@045315 by Wouter van Ooijen

face picon face
> BTW, I have been considering if I should get into the PICs or
> the AVRs

Available support and being able to actually buy the chip are the best
(beginners!) arguments for the choice. Technically you can't go wrong
with either, although for a given project one specific chip (either PIC
or AVR or another type) might be a better fit than others.
Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\09\26@052508 by Wouter van Ooijen

face picon face
> > I am new to this. I was wondering for this beginner circuit:
> >
> > www.piclist.com/techref/piclist/cheapic/bincnt.htm
> >
> > does the C = 33pf designate a Crystal? if not, if it is a
> capacitor then I
> > am confused by the drawing because it says 32.768 kHz but does not
> > show an icon for the crystal

For a first experiment you should consider using a 16f628 (or a 12fxxx)
with its interal oscillator. Not (or barely) accurate enough for serial
communication, but fine for most other purposes.

Also check my page at http://www.voti.nl/wisp628, not for the programmer
but for blink-a-led circuits and programs for most (all?) flash PICs.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...