AnsweredAssumed Answered

ADC sampling

Question asked by ahmed hrabi on Oct 19, 2016
Latest reply on Jun 16, 2017 by ulrik kristiansen

Hello everybody,

 

I'am using the ADC16 on the K64  and here's my config: 

 

Enable the ADC0 Clock
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;

 

CFG1 CONF

ADC0->CFG1 = (0 << 7) |              /* Normal power configuration.*/
(0 << 5) |                                        /* The divide ratio is 1 and the clock rate is input clock. */
(0 << 4) |                                        /* Select short sample time*/
(3 << 2) |                                        /* Select 16-bit conversion*/
(0 << 0);                                         /* Input clock is (Bus clock)*/

 

CFG2 CONF

ADC0->CFG2 = (0 << 4) |             /* ADxxa channels are selected*/
(0 << 3) |                                        /* Async clock output disabled*/
(1 << 2) |                                        /*High-speed conversion sequence */
(3 << 0);                                         /* 2 extra ADCK cycles; 6 ADCK cycles total sample time. */

 

SC1 CONF

ADC0->SC1[0] = (1 << 6) |              /* Conversion complete interrupt enabled */
(1 << 5) |                                          /* DIFF conversions and input ch are selected */
(1 << 0);                                           /* Select DAD1 as input*/

 

 

SC2 CONF

ADC0->SC2 = (0 << 6) |                   /* Software trigger selected*/
(0 << 5) |                                           /* Compare function disabled*/
(0 << 4) |                                           /* Compare configures less than threshold */
(0 << 3) |                                           /* Range function disabled*/
(0 << 2) |                                           /* DMA is disabled*/
(0 << 0);                                            /* Default voltage reference*/

 

SC3 CONF

ADC0->SC3 |= (0 << 2) |                   /* Hardware average function disabled */

 

 

1)How to set the adc on maximum sampling rate ?

2) How to determine the value of the ADC maximum sampling rate with a custom configuration? 

 

Thanks. 

Outcomes