2014-12-07 08:05 PM
After used a lot of time to read and find (and not found), now i have done the code after try it own.
And now, i want to share to you.my project need to get analog input 5 channels from ch0 to ch4 with scan modethat's i don't include all of code, you may consider for some linecode:1. GPIO_Init(GPIOB,GPIO_PIN_ALL,GPIO_MODE_IN_FL_NO_IT); // set IO mode on port B2. ADC1_DeInit();3. ADC1_DataBufferCmd(ENABLE); // enable buffer4. ADC1_ScanModeCmd(ENABLE); // enable scan mode5. ADC1_ITConfig(ADC1_IT_EOCIE,DISABLE); // disable interrupt when using scan mode// scan to channel that's need , this code is scan from ch0 to ch46. ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS,ADC1_CHANNEL_4,ADC1_PRESSEL_FCPU_D18,\ ADC1_EXTTRIG_TIM ,DISABLE,ADC1_ALIGN_RIGHT,\ ADC1_SCHMITTTRIG_CHANNEL4 ,DISABLE); 7. enableInterrupts(); 8. ADC1_StartConversion(); 9. percent=ADC1_GetBufferValue(i); // percent is u16 variable, i is channel want to get valuesyou can get the value in anytimeshope this will help you #stm8s-adc1-scan-mode2017-11-10 02:27 AM
Hi,
could you please share a full code here?