新手上路
- 积分
- 35
- 金钱
- 35
- 注册时间
- 2016-11-29
- 在线时间
- 4 小时
|
发表于 2016-12-6 11:19:54
|
显示全部楼层
本帖最后由 BraveAction 于 2016-12-6 11:21 编辑
/* Configure PA.02 03 07 as analog input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
/* Configure PB.00 01 as analog input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOB, &GPIO_InitStructure); // PB0 PB1 ,输入时不用设置速率
/* Configure PC.04 as analog input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOC, &GPIO_InitStructure); // PC4 ,输入时不用设置速
/*配置ADC1的通道2为55. 5个采样周期,序列为1 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 1, ADC_SampleTime_55Cycles5);
/*配置ADC1的通道3为55. 5个采样周期,序列为2 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_3, 2, ADC_SampleTime_55Cycles5);
/*配置ADC1的通道7为55. 5个采样周期,序列为3 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 3, ADC_SampleTime_55Cycles5);
/*配置ADC1的通道8为55. 5个采样周期,序列为4 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 4, ADC_SampleTime_55Cycles5);
/*配置ADC1的通道9为55. 5个采样周期,序列为5 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_9, 5, ADC_SampleTime_55Cycles5);
/*配置ADC1的通道14为55. 5个采样周期,序列为6 */
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 6, ADC_SampleTime_55Cycles5); |
|