1. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Hi all,

    I am initializing the ADC for a PIC18f4550 microcontroller. I am using the ADC in 10Bit mode and an external Xtal of 20MHz. Can someone please help me select Tad?
    From my calculations I concluded that it should be
    16*Tosc.
    When doing further research online, I found a site that states Tad should be set to 32
    *Tosc for a 20MHz Xtal.
    On another site I found, it says that Tad must not be less than 1.2us. On the other hand, the PIC18F450 datasheet states that Tad MIN. is 0.7us.

    Can someone help me select this parameter for an accurate ADC conversion?

    Thanks in advance.


     
  2. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,979
    744
    Datasheet page 271, says for 20Mhz Xtal it should be 16* Tosc, but i would use the internal Frc osc page 267, as it will give the slowest and most accurate result.
     
  3. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
  4. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    If you do not need a high sampling frequency use the slower of the two, which is 32*Tosc.

    And if you are switchign between two or more ADC inputs allow a longer settling time (Tacq) or even add a couple of mS manually in code after selecting a new ADC pin.
     
  5. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Thanks for the reply.

    So with 32*Tosc, will I get a sampling rate of 1.6us? (using a 20MHz Xtal)

    Another question. The tutorial in the link below suggest an RC circuit at the input of the ADC for stability reasons. Can this have an effect the internal RC of the ADC?

    http://www.edaboard.com/entry1574.html
     
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Check the datasheet for the Tosc times. Whatever it says in uS for 20MHz xtal and 16*tosc, the 32*tosc setting will be double the period in uS.

    Yeah it's fine to put a cap from the ADC input pin to ground. It is usually a good idea to do that if your ADC does not need to have a fast samplerate. In some cases the resistor can affect the ADC reading, but generally a cap will not hurt if the signal is slow changing.
     
Loading...