Setting up the AtoD Sampling

Look up the following in the device datasheet:

Tad = ADC Clock period ADC Clock Period

Sample Time

Conversion Time (value not needed to setup but this tells you how long it will take to convert)

ADCS – ADC Conversion Clock Select bits

ADC_CONV_CLK_#Tcy 

This value sets Tad:

Tpb (Peripheral bus speed) x Value Used = Tad

SAMC – Auto-Sample Time bits

ADC_SAMPLE_TIME_# (A/D Auto Sample Time x Tad)

This value sets the sample time

Example – PIC32MX120F032B

Tad = ADC Clock period ADC Clock Period = 65nS min

Conversion Time  = 12Tad typ

Sample Time = 1Tad min

With a 40MHz osc and 40MHz peripheral bus these values would provide the required times:

ADC_CONV_CLK_3 provides Tad = 75nS

ADC_SAMPLE_TIME_3 provides 3Tad so more than the 1Tad minimum but enuring our input impedance etc doesn't affect the sampling capacitor being fully charged each time.

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *