我想对三路数据进行AD转换,不用同时的,但是这样写的为什么转换的老是设定的第一个Channel的数据呢?数组abc里总是保存的第一个channel的数据 /* ADC1 configuration ------------------------------------------------------*/ ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;// ADC_InitStructure.ADC_ScanConvMode = DISABLE;// ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;//
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;//
ADC_InitStructure.ADC_NbrOfChannel = 3;//
ADC_Init(ADC1, &ADC_InitStructure);
/* ADC1 regular channel10 configuration */
ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_55Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 2, ADC_SampleTime_55Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 3, ADC_SampleTime_55Cycles5); /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE);//
/* Enable ADC1 reset calibaration register */ ADC_ResetCalibration(ADC1); /* Check the end of ADC1 reset calibration register *//
while(ADC_GetResetCalibrationStatus(ADC1));
/* Start ADC1 calibaration */ ADC_StartCalibration(ADC1); /* Check the end of ADC1 calibration */ while(ADC_GetCalibrationStatus(ADC1)); /* Start ADC1 Software Conversion *// ADC_SoftwareStartConvCmd(ADC1, ENABLE); #if 1 while(1) { while(!(ADC_GetFlagStatus(ADC1,ADC_FLAG_EOC))); value = (ADC1->DR); abc[own] = value; own++; if(own == 3) { ADC_Cmd(ADC1,DISABLE); } |