ADC sample time register 2 (ADC_SMPR2)

Второй регистр временных выборок АЦП STM32F10x

Смещение (Address offset): 0x10

Reset value: 0x0000'0000

3130292827262524
Reserved SMP9[2:0] SMP8[2:0]
------rwrwrwrwrwrw
00000000
2322212019181716
SMP7[2:0] SMP6[2:0] SMP5[2:0]
rwrwrwrwrwrwrwrw
00000000


15141312111098
SMP5[2:0] SMP4[2:0] SMP3[2:0] SMP2[2:0]
rwrwrwrwrwrwrwrw
00000000
76543210
SMP2[2:0] SMP1[2:0] SMP0[2:0]
rwrwrwrwrwrwrwrw
00000000


Bits 31:30
Reserved
Must be kept at reset value
Зарезервировано. Должно быть сохранено значение после сброса.
Bits 29:27
SMP9[2:0]
Channel 9 Sample time selection
Выбор времени выборки канала 9.

Устанавливаются программно для индивидуального выбора времени дискретизации для каждого канала. Во время преобразования время выборки должно оставаться неизменным.

Время дискретизации:

 000 :  1.5 цикла

 001 :  7.5 циклов

 010 :  13.5 циклов

 011 :  28.5 циклов

 100 :  41.5 цикла

 101 :  55.5 цикла

 110 :  71.5 цикла

 111 :  239.5 циклов

ADC1: аналоговые входы каналов 16 и 17 подключены соответственно к датчику температуры и входному опорному напряжению.

ADC2: аналоговые входы каналов 16 и 17 подключены к Vss ("земля").

ADC3: аналоговые входы каналов 9, 14, 15, 16, 17 подключены к Vss ("земля").

У остальных каналов время выборки выберается идентично каналу 9.

//- stm32f10x.h

/******************  Bit definition for ADC_SMPR1 register  *******************/

#define  ADC_SMPR2_SMP0         ((uint32_t)0x00000007)        /* SMP0[2:0] bits (Channel 0 Sample time selection) */
#define  ADC_SMPR2_SMP0_0       ((uint32_t)0x00000001)        /* Bit 0 */
#define  ADC_SMPR2_SMP0_1       ((uint32_t)0x00000002)        /* Bit 1 */
#define  ADC_SMPR2_SMP0_2       ((uint32_t)0x00000004)        /* Bit 2 */

#define  ADC_SMPR2_SMP1         ((uint32_t)0x00000038)        /* SMP1[2:0] bits (Channel 1 Sample time selection) */
#define  ADC_SMPR2_SMP1_0       ((uint32_t)0x00000008)        /* Bit 0 */
#define  ADC_SMPR2_SMP1_1       ((uint32_t)0x00000010)        /* Bit 1 */
#define  ADC_SMPR2_SMP1_2       ((uint32_t)0x00000020)        /* Bit 2 */

#define  ADC_SMPR2_SMP2         ((uint32_t)0x000001C0)        /* SMP2[2:0] bits (Channel 2 Sample time selection) */
#define  ADC_SMPR2_SMP2_0       ((uint32_t)0x00000040)        /* Bit 0 */
#define  ADC_SMPR2_SMP2_1       ((uint32_t)0x00000080)        /* Bit 1 */
#define  ADC_SMPR2_SMP2_2       ((uint32_t)0x00000100)        /* Bit 2 */

#define  ADC_SMPR2_SMP3         ((uint32_t)0x00000E00)        /* SMP3[2:0] bits (Channel 3 Sample time selection) */
#define  ADC_SMPR2_SMP3_0       ((uint32_t)0x00000200)        /* Bit 0 */
#define  ADC_SMPR2_SMP3_1       ((uint32_t)0x00000400)        /* Bit 1 */
#define  ADC_SMPR2_SMP3_2       ((uint32_t)0x00000800)        /* Bit 2 */

#define  ADC_SMPR2_SMP4         ((uint32_t)0x00007000)        /* SMP4[2:0] bits (Channel 4 Sample time selection) */
#define  ADC_SMPR2_SMP4_0       ((uint32_t)0x00001000)        /* Bit 0 */
#define  ADC_SMPR2_SMP4_1       ((uint32_t)0x00002000)        /* Bit 1 */
#define  ADC_SMPR2_SMP4_2       ((uint32_t)0x00004000)        /* Bit 2 */

#define  ADC_SMPR2_SMP5         ((uint32_t)0x00038000)        /* SMP5[2:0] bits (Channel 5 Sample time selection) */
#define  ADC_SMPR2_SMP5_0       ((uint32_t)0x00008000)        /* Bit 0 */
#define  ADC_SMPR2_SMP5_1       ((uint32_t)0x00010000)        /* Bit 1 */
#define  ADC_SMPR2_SMP5_2       ((uint32_t)0x00020000)        /* Bit 2 */

#define  ADC_SMPR2_SMP6         ((uint32_t)0x001C0000)        /* SMP6[2:0] bits (Channel 6 Sample time selection) */
#define  ADC_SMPR2_SMP6_0       ((uint32_t)0x00040000)        /* Bit 0 */
#define  ADC_SMPR2_SMP6_1       ((uint32_t)0x00080000)        /* Bit 1 */
#define  ADC_SMPR2_SMP6_2       ((uint32_t)0x00100000)        /* Bit 2 */

#define  ADC_SMPR2_SMP7         ((uint32_t)0x00E00000)        /* SMP7[2:0] bits (Channel 7 Sample time selection) */
#define  ADC_SMPR2_SMP7_0       ((uint32_t)0x00200000)        /* Bit 0 */
#define  ADC_SMPR2_SMP7_1       ((uint32_t)0x00400000)        /* Bit 1 */
#define  ADC_SMPR2_SMP7_2       ((uint32_t)0x00800000)        /* Bit 2 */

#define  ADC_SMPR2_SMP8         ((uint32_t)0x07000000)        /* SMP8[2:0] bits (Channel 8 Sample time selection) */
#define  ADC_SMPR2_SMP8_0       ((uint32_t)0x01000000)        /* Bit 0 */
#define  ADC_SMPR2_SMP8_1       ((uint32_t)0x02000000)        /* Bit 1 */
#define  ADC_SMPR2_SMP8_2       ((uint32_t)0x04000000)        /* Bit 2 */

#define  ADC_SMPR2_SMP9         ((uint32_t)0x38000000)        /* SMP9[2:0] bits (Channel 9 Sample time selection) */
#define  ADC_SMPR2_SMP9_0       ((uint32_t)0x08000000)        /* Bit 0 */
#define  ADC_SMPR2_SMP9_1       ((uint32_t)0x10000000)        /* Bit 1 */
#define  ADC_SMPR2_SMP9_2       ((uint32_t)0x20000000)        /* Bit 2 */