本帖最后由 grissiom 于 2011-11-17 14:03 编辑
3.5.0 的标准外设库。 stm32f10x_adc.c 第 92 行是
/* ADC Software start mask */
#define CR2_EXTTRIG_SWSTART_Set ((uint32_t)0x00500000)
然后
- /**
- * @brief Enables or disables the selected ADC software start conversion .
- * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
- * @param NewState: new state of the selected ADC software start conversion.
- * This parameter can be: ENABLE or DISABLE.
- * @retval None
- */
- void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
- {
- /* Check the parameters */
- assert_param(IS_ADC_ALL_PERIPH(ADCx));
- assert_param(IS_FUNCTIONAL_STATE(NewState));
- if (NewState != DISABLE)
- {
- /* Enable the selected ADC conversion on external event and start the selected
- ADC conversion */
- ADCx->CR2 |= CR2_EXTTRIG_SWSTART_Set;
- }
- else
- {
- /* Disable the selected ADC conversion on external event and stop the selected
- ADC conversion */
- ADCx->CR2 &= CR2_EXTTRIG_SWSTART_Reset;
- }
- }
也就是说每次软件启动 ADC 的时候都会使能外部事件启动转换?为啥要这样呢?请大侠点解……
|