/* Enable End of conversion ADC1 Interrupt */
ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE);
/* Start ADC1 Conversion using Software trigger*/
ADC_SoftwareStartConv(ADC1);
}
/**
* @brief ADC1/Comparator Interrupt routine.
* @param None
* @retval None
*/
INTERRUPT_HANDLER(ADC1_COMP_IRQHandler,18)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
{
CLK_PeripheralClockConfig(CLK_Peripheral_ADC1,ENABLE);
ADC_DeInit(ADC1);
ADC_VrefintCmd(ENABLE);
/* Enable ADC1 */
ADC_Cmd(ADC1, ENABLE);
GPIO_Init(GPIOB,GPIO_Pin_0,GPIO_Mode_In_PU_No_IT);
/* Initialise and configure ADC1 */
ADC_Init(ADC1, ADC_ConversionMode_Continuous, ADC_Resolution_12Bit, ADC_Prescaler_2);
ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels, ADC_SamplingTime_384Cycles);
/* Enable ADC1 Channel 18 */
// ADC_ChannelCmd(ADC1, ADC_Channel_18, ENABLE);
ADC_ChannelCmd(ADC1, ADC_Channel_Vrefint, ENABLE);
/* Enable End of conversion ADC1 Interrupt */
ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE);
/* Start ADC1 Conversion using Software trigger*/
ADC_SoftwareStartConv(ADC1);
}
/**
* @brief ADC1/Comparator Interrupt routine.
* @param None
* @retval None
*/
INTERRUPT_HANDLER(ADC1_COMP_IRQHandler,18)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
ADCdata = ADC_GetConversionValue(ADC1);
}
一周热门 更多>