How to choose best oscillator frequency?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    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 ?

  2. #2


    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

  3. #3
    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 ?

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

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