好吧,上代码。谢谢各位了!此处仅上ADC配置和中断服务程序!详细程序在附件中! void ConfigAdMode(void)
{
ADC_InitTypeDef
my_ADC_InitStructure;
ADC_DeInit(ADC1);
ADC_StructInit(&my_ADC_InitStructure);
my_ADC_InitStructure.ADC_Mode
= ADC_Mode_Independent; //独立模式
my_ADC_InitStructure.ADC_ScanConvMode
= DISABLE; //debug yuanlai使能
my_ADC_InitStructure.ADC_ContinuousConvMode
= DISABLE; //debug yuanlai失能
my_ADC_InitStructure.ADC_ExternalTrigConv
=ADC_ExternalTrigConv_T1_CC1;
my_ADC_InitStructure.ADC_DataAlign
= ADC_DataAlign_Right;
my_ADC_InitStructure.ADC_NbrOfChannel
= AC_CLASS_NUM;
ADC_Init(ADC1,
&my_ADC_InitStructure);
ADC_RegularChannelConfig(ADC1,
ADC_Channel_4, AC_CLASS_ACV+1, ADC_SampleTime_1Cycles5);
ADC_RegularChannelConfig(ADC1,
ADC_Channel_5, AC_CLASS_ACI+1, ADC_SampleTime_1Cycles5);
}
void
ADC1_2_IRQHandler(void)
{ if(ADC_GetITStatus(ADC1,ADC_FLAG_EOC)==
SET)
ADC_ClearITPendingBit(ADC1,ADC_FLAG_EOC); {
ADC_ClearFlag(ADC1,ADC_FLAG_EOC);
g8_Sysadc%=150;
gm_SampleTempData.ACdata1[g8_Sysadc][0]=ADC_GetConversionValue(ADC1);
}
g8_Sysadc++;
}
|