| 数据搜索系统,热门电子元器件搜索 |
|
AN3023 数据表(PDF) 13 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3023 数据表(HTML) 13 Page - STMicroelectronics |
|
13 / 23 page ![]() AN3023 Configuring ADC registers for conversion Doc ID 16113 Rev 1 13/23 the CONT bit is cleared while conversion is ongoing, conversion stops the next time the last channel has been converted. Example 4 ● fMASTER = 4 MHz ● fADC = 2 MHz ● Continuous scan from AIN0 to AIN3 channel ● Right alignment ● Starting ADC by TIM1 For Example 4, the ADC registers should be configured as follows: ADC_CR1:SPSEL[2:0] = 000 → f ADC = 2 MHz (that is, fMASTER/2) ADC_CSR:CH[3:0] = 0011 → channel from AIN0 to AIN3 ADC_CR1:ADON = 1 → ADC power on Wait (14/fADC) → stabilization time before starting the conversion ADC_CR1:CONT = 1 → continuous conversion mode ADC_CR2:SCAN = 1 → scan mode enable ADC_CR2:ALIGN = 1 → right alignment ADC_CR2:EXTSEL[1:0] = 00 → Internal TIM1 TRGO event ADC_CR2:EXTTRIG = 1 → conversion on external event is enabled Timer initialization for trigger output: The timer has to be configured in PWM mode, with a period of at least 7 µs, in order to guarantee a good ADC conversion. fMASTER = 4 MHz, Prescaler = 1, TIM1 counter clock = 2 MHz PWM signal @50 kHz (period = 20 µs) TIM1_SMCR:MSM = 1 → TIM1 configured as master mode TIM1_CR2:MMS[6:4] = 100 → OC1REF signal is used ad trigger output (TRGO) TIM1_CR1:CEN = 1 → Timer counter enable ADC conversion will start at each rising edge event of OC1REF signal Wait (ADC_CSR:EOC = 1) → end of conversion Read the result of the current conversion from ADC_DBxRH and ADC_DBxRL registers (x = 0..3) before of the end of next conversion. The OVR flag is set if one of the buffer registers is overwritten. Note: 1 In scan mode, do not use the bit manipulation instruction (BRES) to clear the EOC flag because it performs a read-modify-write on the whole ADC_CSR register, reading the current channel number from the CH[3:0] register and writing it back. This changes the last channel number for the scan sequence. The correct way to clear the EOC flag in continuous scan mode is to load a byte in the CSR register from a RAM variable, clearing the EOC flag and reloading the last channel number for the scan sequence. 2 When using scan mode, it is not possible to use channels AIN0 to AINn in output mode because the output stage of each channel is disabled when it is selected by the ADC multiplexer. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |