+ Reply to Thread
Results 1 to 13 of 13

Thread: oscillator

  1. #1
    Angy Newbie
    Join Date
    Nov 2008
    Posts
    63

    Default oscillator

    I have 4mhz crystal oscillator connected to a micro(16f946) with 27pf on both its legs.
    How do I know that its working the right way?
    I put a probe on it and I looked at the signal, it looks something like a sinewave but not exactly like one.
    Can someone please explain.


  2. #2
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,745

    Default

    Alot of people might tell you:

    Hey it has a 8mhz internal OSC why use a Crystal.

    But i wont...
    The best way to test it in my opinion is to do some type of timed test like since you can probe it .. try flashing a LED at max speed. Since the pic cuts the OSC in 4 it will be 1 Mhz only so you can use the probe to verify its flashing at that speed.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  3. #3
    Angy Newbie
    Join Date
    Nov 2008
    Posts
    63

    Default

    Thanks for your response.
    I understood from your response that a 4mhz crystal gives a 1Mhz internal clock frequency.( do all the pic's cut it by 4?)
    Actual Frequency=so internal clk frequency /256=3906.25Hertz
    1/3906.25=256uS is the time period?

    Can you please explain, I would like to know what a 4Mhz with 27pf signal on the scope should look like?(sine wave?)

    Is the amplitude of waveform controlled by Vdd ?
    For this particular chip it says 20Mhz oscillator clock input on the datasheet. what does this mean?

  4. #4
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default

    Quote Originally Posted by Angy View Post
    I have 4mhz crystal oscillator connected to a micro(16f946) with 27pf on both its legs.
    How do I know that its working the right way?
    I put a probe on it and I looked at the signal, it looks something like a sinewave but not exactly like one.
    Can someone please explain.
    As long as you are getting a rising edge thing should be fine. If your signal looks a bit like a sine wave, that is just because it is taking time to rise....

    Yes, all PICs divide the oscillator input by 4. See any data sheet....
    for why.

    There is a difference between a crystal - like what you have with two pins, which needs a small capacitor on each leg to ground... and uses the PIC's internal hardware to create an oscillator. You can also clock a PIC with an oscillator, which is a self contained oscillator in a can. These usually have four legs, and put out a fairly strong signal, as opposed to the signal you will read from a leg of the crystal.

    If I have some time today, I'll scope one and post the picture.

  5. #5
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,745

    Default

    Im no guru but i can tell you what i know to get started. I know nothing on scopes

    all PICs cut the clock by 4.. I think it applies to External and Internal.

    So if you use a 20 Mhz crystal on it. It will essentially be a 5Mhz pic.

    To connect any crystal to a pic i recommend follow the datasheet. in your case it starts on page 73.

    Most important is page 78. I dont like that datasheet tho it doesnt show good enough information.

    Here is a image of a part from the PIC16F54 Data sheet. It tells you recommended capacitance for the OSC. Hope it helps you.

    Attached Images
    Last edited by AtomSoft; 29th January 2009 at 04:11 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  6. #6
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default

    Jason,
    The helpful illustration of how the clock divider works with instruction pipe lining would be a good one to include here too. Do you know which illustration I'm referring to?

  7. #7
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,745

    Default

    Yeah i think 1 minute:
    This shows you how everything works.
    Here ya go:
    Attached Images
    Last edited by AtomSoft; 29th January 2009 at 04:18 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  8. #8
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default



    That's the one! Thanks.

  9. #9
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,745

    Default

    heh im glad i could help

    Ill see you guys in a bit ... lunch time
    Last edited by AtomSoft; 29th January 2009 at 04:21 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  10. #10
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,791

    Default

    Anyway - back to the original question

    The clock oscillator on a PIC (or other processor) looks like a fairly rough sinewave on a scope - it's also important to use a x10 probe, as the scope will often stop the oscillator otherwise.

    Basically, if there's anything shown on the scope, it's working OK.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  11. #11
    Angy Newbie
    Join Date
    Nov 2008
    Posts
    63

    Default

    Thank you all for your suggestions, I appreciate your help.

    I'm just going to assume that the oscillator is working right.
    Now the actual problem I'm facing is with the AD converter.
    When I simulate the software I get the error below, I already looked the same thread on this website but they did not give the solution.
    ADC-W0008: No stimulus file attached to ADRESL for A/D.
    so as the warning say no stimulus is attached to address register where the a/d value is stored.so can someone explain what I'm doing wrong?

    Thanks.

  12. #12
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,745

    Default

    heh your not doing anything wrong...

    you just arent doing it fully...

    i dont know how to attach that file but when you simulate something it has to know what values to send to it. Thats where that file comes in. I know someone will help
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  13. #13
    Angy Newbie
    Join Date
    Nov 2008
    Posts
    63

    Default

    Can someone please explain How I should go about attaching stimuls file?
    Thanks
    Last edited by Angy; 30th January 2009 at 01:38 PM.

+ Reply to Thread

Similar Threads

  1. Oscillator NOT
    By 3v0 in forum Micro Controllers
    Replies: 24
    Latest: 27th February 2007, 03:58 PM
  2. Oscillator
    By zefiris2K5 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 18
    Latest: 10th January 2006, 12:28 PM
  3. Oscillator
    By rudolph in forum Datasheet/Parts Requests
    Replies: 1
    Latest: 5th December 2005, 03:04 PM
  4. oscillator
    By EARTH6 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 3
    Latest: 18th July 2005, 02:21 AM
  5. 400 mhz oscillator
    By santosh_iitm2002 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 3
    Latest: 21st September 2004, 08:04 AM

Tags for this Thread