chipKIT® Development Platform

Inspired by Arduino™

Sampling Accuracy of the PIC32

Created Tue, 28 Jan 2014 08:42:32 +0000 by cobusmetnc


Tue, 28 Jan 2014 08:42:32 +0000

I am currently trying to do signal analysis with the PIC32. I wish to setup the sampling frequency in such a way as to reduce the processing time for my signal analysis. I have however found that the setting up of the sampling time is somewhat dodgy. What I want to know is how accurate is the sampling frequency with respect to the setting up of the registers for a given sampling time.


Tue, 28 Jan 2014 10:30:24 +0000


I'm sorry, but that is all that can be said about that.

If you want more detail:

The sampling frequency and associated timings are as accurate as the clock source you are providing for them, and that depends on how you set up the registers. If you configure it to use the ADC's internal RC oscillator it will be less accurate than if you set it up for using the system clock. If you are using a timer to trigger the sampling it will depend on how you set the timer up, what its clock source is, etc.

So without knowing how you are intending to set up the clock source, there is no valid answer.


Wed, 29 Jan 2014 09:54:29 +0000

I am using the peripheral clock with a 1 divisor from the system clock which is 80Mhz. When I set the registers to the appropriate values I will still find some margin of error. When setting up for 50kHz I would receive 47kHz. Is this by any chance normal?

Thank you


Wed, 29 Jan 2014 11:11:40 +0000

Please provide some code to show what it is you are doing. WHAT are you setting to 50KHz?


Wed, 29 Jan 2014 13:46:33 +0000

I found the problem. It boils down to using pg24 through to 25 of the Microchip ADC reference guide.

Thanks for those who answered