I can read ADC value from ADC1_IN1 channel with this code ADCValue = HAL_ADC_GetValue(&hadc1);
but ADC1 port (you can see on picture) has many channels. How can I read values from ADC1_IN2 ? How can I describe channel 2 in code ?
Asked
Active
Viewed 2,320 times
3

coollime
- 147
- 1
- 3
- 11
-
what did ST say when you asked them? – old_timer Jan 17 '17 at 18:06
-
I am not a friend of ST,so I didn't ask them. – coollime Jan 18 '17 at 07:08
-
2http://visualgdb.com/tutorials/arm/stm32/adc/ good tutorial – Bence Kaulics Jan 18 '17 at 09:47
-
Thanks @BenceKaulics – coollime Jan 18 '17 at 11:53
1 Answers
2
You can set ADC Channel by HAL_ADC_ConfigChannel
function :
ADC_ChannelConfTypeDef sConfig;
sConfig.Channel = ADC_CHANNEL_2; // ADC Channel
sConfig.Rank = 1; //Rank (1-16) Rank: The rank in the regular group sequencer.
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES; //ADC Sampling Times
sConfig.Offset = 0; // Reserved
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) {
//Error
}

HamidReza
- 717
- 7
- 17
-
1How will be usage of GetValue() Function ? `HAL_ADC_GetValue(&hadc1);` – coollime Jan 18 '17 at 07:11