设置了注入模式,两个通道的。
#define ADC_UREF GPIOA
#define ADC_UREF_Pin GPIO_Pin_6
#define ADC_UREF_CHN ADC_Channel_6
#define ADC_UBAT GPIOA
#define ADC_UBAT_Pin GPIO_Pin_8
#define ADC_UBAT_CHN ADC_Channel_8
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_InitStructure.GPIO_Pin = ADC_UBAT_Pin;
GPIO_Init (ADC_UBAT,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADC_UREF_Pin;
GPIO_Init (ADC_UREF,&GPIO_InitStructure);
/* Set injected sequencer length */
ADC_InjectedSequencerLengthConfig(ADC1, 2);
/* ADC1 injected channel Configuration */
ADC_InjectedChannelConfig(ADC1, ADC_UREF_CHN, 1, ADC_SampleTime_1Cycles5);
ADC_InjectedChannelConfig(ADC1, ADC_UBAT_CHN, 2, ADC_SampleTime_1Cycles5);
UREF得到的数据正常,而UBAT都是4095,而我用万用表测量才1V左右。是PA8要进行设置什么的吗? |