How do you calculate the sampling rate for a SAR ADC on PIC16F MCU?

The sampling time for devices like the PIC16F18325/45, which utilizes a successive approximation register (SAR) ADC, is not specified in the datasheet. There are a lot of dependencies that affect the sampling rate, so it is hard to specify. For an approximate best case of the sampling rate, this formula can be used:

Sample Rate = (TAD x 12) +TACQ + (Number of instruction cycles to read the ADRES registers and write to memory).

There are a number of dependencies for each variable:

• TAD (Period of A/D Conversion) - times depend on the ADCS bits and the device frequency. You would need to calculate the TAD based on your settings.
• TACQ (Period of A/D acquisition time) - times are dependent on temperature and external impedance. You would use your nominal operating temperature, and approximate the external impedance to the channel.

The number of instruction cycles is dependent on whether or not an interrupt is used, how the ADRES register reading is handled, and how the data is stored.

If ADC interrupts are used, the cycle times would increase due to the interrupt vectoring, and there is only an estimate of how many instructions it takes to jump to the vector (typically from two to five instructions). If the code reads the ADRES registers, then saves the value in RAM, that will take fewer instructions compared to writing the values to EEPROM or Flash.

Finally, each ADC channel does not have a specified sampling rate. For example, based on the information above, if channel X has an impedance of 200 Ω, while channel Y has 2 kΩ, channel X would likely have a faster rate since it takes a little less time for the sample and hold capacitor to charge. Another thing to consider is whether or not the ADC is kept on the whole time during operation, or if the ADC is turned off between acquisitions, and how often the application will switch to a new channel.

To summarize, there isn't a sampling rate specification for this ADC. A fair approximation can be made using the information above, but it is not a guaranteed rate.

© 2019 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.