2017-07-17 02:06 AM
I want to read the ADC sample value connected to Port B pin 0, when I check the sampling speed, I get it as 1.152 milli seconds per sample, can you let me know if my setting are correct. I am not using timer1 in my code.
//Clock Configuration
static void CLK_Config(void)
{ CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); return;}//ADC configuration
static void ADC_Config( void )
{ ADC1_DeInit();ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, ADC1_CHANNEL_0, ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_TIM,DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL0, DISABLE );ADC1_ITConfig(ADC1_IT_EOCIE, ENABLE);
ADC1_StartConversion();return;
}//GPIO Configuration
GPIO_Init(GPIOB, GPIO_PIN_0, GPIO_MODE_IN_FL_NO_IT);
GPIO_Init(GPIOB, GPIO_PIN_1, GPIO_MODE_OUT_PP_LOW_FAST);
//ADC ISR 22
void ADC1_Sample_IRQHandler(void)
{ PeakHold = ADC1_GetConversionValue(); ADC1_ClearITPendingBit(ADC1_IT_EOCIE); ADC1_ClearFlag(ADC1_IT_EOC); ADC1->CR1 |= ADC1_CR1_CONT; GPIO_WriteReverse(GPIOB, GPIO_PIN_1);}when I monitor the pin 1 in oscilloscope, I see the signal is changing it's state every 1.152 msecond. But the manual says the ADC speed is 2.33 micro second. Can I know what is the mistake in my configuration.