Max Input Frequency

Discussion in 'General Electronics Chat' started by olvine, Mar 10, 2014.

  1. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    Hi..

    I want to know that what's the maximum frequency we can put to analog input pin in PIC16F887 ?
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380

    hi,
    The limiting factor is the Acquisition time of the ADC.

    Look at this image of a LTSpice simulation of the PIC'a ADC.

    E
     
  3. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    okay thanks.

    And what if i want to measure the frequency which is more than the maximum frequency then what method should be used instead of using ADC.
     
  4. pwdixon

    Member

    Oct 11, 2012
    488
    56
    You could try a comparator and a timer interrupt.
     
  5. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    What's the limit for comparator input according to frequency ?
     
  6. alfacliff

    Well-Known Member

    Dec 13, 2013
    2,449
    428
    if you need to count a higher frequency than the input will count, use a prescaler. such as a shotkey series devide by 10 counter. if you need more, there are lots of prescaler (frequency deviders) chips and circuits.
     
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    You have not said anything about what kind of waveform you want to measure nor its expected frequency range. As long as we are not sitting beside at at your workbench. We will not be able to help you in a proper way. Please provide adequate details of your project
     
  8. pwdixon

    Member

    Oct 11, 2012
    488
    56
    The limit will be determined by the timer frequency clock source, what frequency are you hoping to measure?
     
  9. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Use a PIC series with higher sample rate.
     
  10. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi alfa,
    I think the OP is asking about the ADC input frequency maximum sampling rate.

    E
     
  11. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi,
    Tell us more about the project, details of which parameters you need to measure.

    E
     
  12. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    If I am talking about analog signal and frequency then it could be any analog signal with some frequency.
    But I want to calculate sine wave's frequency using PIC16F887.
     
  13. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    And I want to know the minimum time required by controller to calculate comparators output ?
     
  14. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    There are a lot of simple "PIC frequency meter" projects you can google.

    Most measure up to 50 MHz, which is about the max you can detect with a PIC input pin (usually the TMR1 external clock input pin).

    You should provide more details on your needs;
    1. What voltage (amplitude) is the sinewave?
    2. What frequency range do you want to measure?
    3. How much experience do you have writing code for precise timing projects with a PIC?
    :)
     
  15. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    Does Timer1 external clock input pin take sine wave ?

    sine wave is 4V and the frequency range is the maximum i can get.
    Not too much experience but some experience ;)
     
  16. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    And please tell me how can I calculate the amplitude using this controller.

    ...on high frequencies when ADC miss the samples of sine wave.

    Is there any algorithm for that or any method which would be close to actual value ?
     
  17. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    I am trying to do some kind of abstract programming :)
     
  18. russ_hensel

    Well-Known Member

    Jan 11, 2009
    818
    47
    A point that may not be clear is that using the ADC to determine frequency is not a great way, for waves of know wave shape using the counter timer is the way to go. This is implicit in several of the answers given so far, but I am not sure it is clear to olvine, but
    perhaps it is.
     
  19. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    You have a sinusoid with frequency of 10 Hz. You are feeding this sinusoid to ADC. What should be a minimum sampling frequency of ADC? 10*2=20 Hz. So you got to Digikey or Mouser and look for ADC chips that have 20 Hz or higher sampling frequency.

    Since you are using PIC with built in ADC, make a list of your input signals, from that list select signal with highest frequency, multiply that frequency by 2, now you have your the sampling frequency that you need, take this sampling frequency and look for PIC that has it or has even higher ADC sampling frequency.

    As far as determining the frequency of the input signal, write sorting algorithm to select two nearest highest values, calculate the time between these two values, divide 1 by the time that you just found, now you have frequency of the input signal.
     
  20. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    That input pin is a schmidt trigger input, and you can trigger it with any shape wave that goes higher than the Hi threashold (about 3.8v) and lower than the LO threshold (about 1.2v). Total hysteresis; 3.8 - 1.2 = 2.6v.

    So technically you can trigger it with any wave that is larger than 2.6v peak to peak.

    The questions you are asking seem to show that you have not had much experience inputting frequency waves into a PIC.

    You really need to decide if you want to work digitally with the wave and only need to measure its frequency, or if you want to measure the wave with the ADC which is much slower (limits max freq) but lets you get more information about the wave, like its voltage and shape.

    PLEASE provide more information, on exactly WHAT you are measuring and WHY you need to measure it. That stops us guessing in the dark, which wastes everyone's time (including yours).
     
    t06afre likes this.
Loading...