本帖最后由 fanhoufa 于 2014-10-23 16:37 编辑 STM32F0 如果用ADC1做AD采样8路模拟值 ,跟据资料如果设定12B的精度,时间最快是2US,如果用连续模式采样8路.16US,这样的采样值稳定吗? /* ADC1 registers reset ----------------------------------------------------*/ ADC_DeInit(ADC1); /* ADC Calibration */ ADC_GetCalibrationFactor(ADC1); /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE); /* Wait the ADRDY falg */ while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADRDY)); { } /* ADC1 configuration ------------------------------------------------------*/ ADC_StructInit(&ADC_InitStructure); ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; // ½ûÓÃÁ¬Ðøģʽ ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Left; // Êý¾Ý×ó¶ÔÆë ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_TRGO; // T1 ´¥·¨×ª»» ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;// ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; // 12λ¾«¶È ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward;// ÏòÉÏɨÃè 0-18 ADC_Init(ADC1, &ADC_InitStructure); ADC_ChannelConfig(ADC1, ADC_Channel_0 | ADC_Channel_2| ADC_Channel_3 | ADC_Channel_4 | ADC_Channel_5 | ADC_Channel_6| ADC_Channel_7| ADC_Channel_8, ADC_SampleTime_13_5Cycles); ADC_GetCalibrationFactor(ADC1); // ʹÄÜǰУ׼ ADC_Cmd(ADC1, ENABLE); // ʹÄÜADC1 while(ADC_GetFlagStatus(ADC1, ADC_FLAG_ADEN) == RESET); // µÈ ADC1ʹÄÜÍê³É ADC_OverrunModeCmd(ADC1,ENABLE); // ʹÄÜÊý¾Ý ģʽ ADC_DMACmd(ADC1, ENABLE); // ʹÄÜADC_DMA ADC_DMARequestModeConfig(ADC1, ADC_DMAMode_Circular); // ÅäÖÃDMAģʽΪѻ·Ä£Ê½ ADC_StartOfConversion(ADC1); // Æô¶¯Ò»´Îת»» |
【STM32F0开发日志/评测/笔记】+互补PWM波的产生
STM32F030 PB14和PB15无法输出PWM求助
【STM32F030探索套件】序列之五 外部中断
【STM32F0开发日志---二】+ucosii.2.92移植在STM32F030
上传个STM32F0+5110+内部温度传感器的菜鸟实例
【STM32F030探索套件使用问题】STM32F030 SPI方式驱动ST7565LCD失败
求一份STM32F051 I2C驱动LCD 12864的例程
STM32F0 M0 向结构体赋值进入HardFault异常
STM32F0 ADC-DMA方式采集2路数据时出现问题
STM32F030C8T6,TIM16定时慢很多问题?
/* ADC1 registers reset ----------------------------------------------------*/
ADC_DeInit(ADC1);
/* ADC Calibration */
ADC_GetCalibrationFactor(ADC1);
/* Enable ADC1 */
ADC_Cmd(ADC1, ENABLE);
/* Wait the ADRDY falg */
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADRDY));
{
}
/* ADC1 configuration ------------------------------------------------------*/
ADC_StructInit(&ADC_InitStructure);
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; // ½ûÓÃÁ¬Ðøģʽ
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Left; // Êý¾Ý×ó¶ÔÆë
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_TRGO; // T1 ´¥·¨×ª»»
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;//
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; // 12λ¾«¶È
ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward;// 옃샬̏ 0-18
ADC_Init(ADC1, &ADC_InitStructure);
ADC_ChannelConfig(ADC1, ADC_Channel_0 | ADC_Channel_2| ADC_Channel_3
| ADC_Channel_4 | ADC_Channel_5 | ADC_Channel_6| ADC_Channel_7| ADC_Channel_8,
ADC_SampleTime_13_5Cycles);
ADC_GetCalibrationFactor(ADC1); // ʹÄÜǰУ׼
ADC_Cmd(ADC1, ENABLE); // ʹÄÜADC1
while(ADC_GetFlagStatus(ADC1, ADC_FLAG_ADEN) == RESET); // µÈ ADC1ʹÄÜÍê³É
ADC_OverrunModeCmd(ADC1,ENABLE); // ʹÄÜÊý¾Ý ģʽ
ADC_DMACmd(ADC1, ENABLE); // ʹÄÜADC_DMA
ADC_DMARequestModeConfig(ADC1, ADC_DMAMode_Circular); // ÅäÖÃDMAģʽΪѻ·Ä£Ê½
ADC_StartOfConversion(ADC1); // Æô¶¯Ò»´Îת»»
相对于逐次逼近型AD,ΔΣ型AD是转换速度慢,分辨率高,单次采样值比较稳定。