How to choose best oscillator frequency?


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2007
    Posts
    56

    Default How to choose best oscillator frequency?

    How do you guys pickup the best oscillator frequency for your application?
    The higher the better ?

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Not alway's true
    If low power consumption is required then a low frequency is then good.
    If you use the internal u(s)art, look then what baudrate you want to use, and with which xtal you can build it.
    Also the frequency of the pwm depends on the xtal freq.

  3. #3
    Join Date
    Jun 2007
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Thanks Mat

    Aside of those issues, is there really a " performance" differences by clocking the PIC higher ? Better processing speed ?

    I am new to PIC, but I guess as it happens on PC , the higher the frequency, the better is the performance ( 3,2 Ghz vs. 1.6 Ghz )

  4. #4


    Did you find this post helpful? Yes | No

    Default There is NO "best" speed

    The oscillator speed must be chosen to meet your overall design objectives. There is no point running at 20 MHz if you are driving slow devices with the PWM output. There, 4 MHz may be a better solution. Likewise if you need specific timing pulses from TMR0 or TMR1 then you must balance the timer bit length with the clock speed and the desired output rate. If you want longest battery life then slower clocks are better.

    In general a faster clock lets you get through more code per unit time so faster is better but you must look at the other system requirements.

    HTH
    Brian

  5. #5
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default 10 MHz is great

    If you use a 18- pic with PLL then 10 is a good choice. Not that power hungry at 10 but with the possibility to kick in the "turbo" and go to 40 MHz with just a change in the config fuses.

    /me

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Johan View Post
    Aside of those issues, is there really a " performance" differences by clocking the PIC higher ? Better processing speed ?

    I am new to PIC, but I guess as it happens on PC , the higher the frequency, the better is the performance ( 3,2 Ghz vs. 1.6 Ghz )

    Wrong !

    A 3000 MHz Sempron running on a bad motherboard (integrated graphics and/or SIS) is slower than a fine Centrino (Pentium III-fellow) with about 1600 MHz !


    For the PICs:
    You must look at your demands...
    All the "normal" things can be done by 4MHz...
    Very-Low-Power may use 32kHz RC,
    CAN-Bus may require 16MHz or more,
    USB requires 48MHz for the USB-part, the core runs slower.
    Currently I have a projekt where I change from 4MHz to 16MHz by using the internal RC-oszillator, because I choose to interrupt the work 4000 times a second to monitor a serial signal... so, there is enough power...

    4MHz up to 12MHz can be realized by cheap resonators instead of a quartz.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  7. #7
    Join Date
    Jun 2007
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Hmmm....

    Suppose I have 8 ADC running at 10 bit and then do some math with the values, then output it to 8 HPWM on a chip like 18f4431, total code around 8k byte, will 8mhz internal osc be sufficient, or will there be a lag somewhere ?

  8. #8


    Did you find this post helpful? Yes | No

    Default Code execution time - very roughly

    ALL digital systems have delays and they are almost always variable depending where in the code loop the event you are looking for takes place.

    Assume each ADC takes 50 uSec, 100 instructions of maths at 1 uS per instruction per channel, then 8 writes to the HPWM outputs each at 50 uSecs. Yes your mileage will vary but these values are in the ball park.

    That makes a complete cycle of 8 inputs to 8 outputs about 400 uSecs for the ADC, 800 uSecs for the maths, plus a further 400 uSecs for the HPWM writes. 1600 uSecs - say 2 mSecs to be safe. If your code does nothing other than scan 8 inputs and write 8 HPWM outputs there will be up to about 2 mSecs delay from input to output.

    You will have to decide if your application can live with that.

    Cheers
    Brian

  9. #9
    Join Date
    Jun 2007
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Thanks Brian,

    Yes , this is what I meant.

    You said it will be about 2 ms delay from input to output, is it based on 8 Mhz oscillator ?

    If I want to change the delay to 1 ms, is it as simple as to change the oscillator to 16 Mhz ?

  10. #10
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BigWumpus View Post

    Wrong !

    USB requires 48MHz for the USB-part, the core runs slower.
    Hmm, I don't believe this statement is quite right either. Depending on your clock setup, you can have both the usb and core running at 48MHz.

    Concidering you can drive the Osc inputs with a 4MHz xtal and pump it up to 48MHz thats value for money!!

    I generally like using 20Mhz xtals because the body is small flat and rigid.

    For non time critical (commercial) apps - I just use the internal RC osc.

    When using Timers with interrupts etc- in general you can get longer delays when using a slower clock.

    Squib

Similar Threads

  1. Too many pics to choose from
    By Luckyborg in forum General
    Replies: 1
    Last Post: - 11th March 2010, 18:49
  2. What bluetooth module to choose?
    By mbox in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th November 2009, 23:01
  3. Count Bits, Choose High or Low?
    By kevj in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd January 2009, 19:17
  4. Can't choose 16F84A?
    By Alex-I in forum mel PIC BASIC
    Replies: 4
    Last Post: - 18th September 2006, 18:51
  5. Push Button 'Menu' to Choose Variable.
    By Tissy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th March 2005, 07:00

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts