Hello I am using PIC18F26K83 and I need to use ADC module in it, in order to measure voltage value of a spesific pin. MCU clock frequency is 8 MHz. This PIC has 12-bit ADC inside of it. So my question is: How should I select the ADC clock frequency. I have seen that people say acquisition time must be at least 1.6 us.2 to 6 us is preferred. So I have 8 MHz system clock. Which makes 0.125 us. Fortunately I can divide this down. Now I have 2 questions.

  1. I am not sure but I think for my MCU it takes 4 clock cycles for 1 operation. Should I consider this while I am trying to calculate the Tac? If yes then without any division period will be 0.5 us instead of 0.125. Then I can divide my MCU clock by 8 and I will get 4 us Tac. Does it sound correct?
  2. In the datasheet there is a picture like this: ADCLK register

according to this image if I want to divide my Fosc by 8 I need to set this register to: 0b00000010 right? and 0b00000011 for dividing 16 and it goes like this. Is it the correct pattern? I just want to be sure. Thanks beforehand.


1 Answer 1

  1. You shouldn't need to take this into consideration. Fosc is the oscillator frequency (system clock). FCY is the instruction clock which is Fosc/4. The selections for CS in ADCLK refer to Fosc and not FCY. see table TABLE 37-1 in datasheet.
  2. division of 16 should give you conversion clock of 2us (if Fosc=8MHz). You'll notice increments of two per 1 bit and starting at 2.
    div 2 =  000000
    div 4 =  000001
    div 6 =  000010
    div 8 =  000011
    div 10 = 000100
    div 12 = 000101
    div 14 = 000110
    div 16 = 000111


ADCLK.CS = (div / 2) - 1

  • \$\begingroup\$ Thanks! So what would be the proper divider for Fosc in ADC clock? Do you have any idea related to it? \$\endgroup\$ Apr 16, 2019 at 7:54
  • \$\begingroup\$ Just to repeat -- "division of 16 should give you conversion clock of 2us (if Fosc=8MHz)" i.e. ADCLK.CS = 0b000111 \$\endgroup\$
    – pm101
    Apr 16, 2019 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.