Skip to main content
migmel
Associate III
January 4, 2023
Solved

How to do multiple ADC conversions if pins belonging to different ports

  • January 4, 2023
  • 1 reply
  • 1514 views

Hello guys,

This is a silly question, but still cannot get it right.

I want to read different values coming from sensors connected to different ports.

I know using 16 available channels for external input is very intuitive when all the inputs come from pins in the same port. But lets say I have inputs and GPIOA, pin1 and GPIOC pin1, and etc... How to set them in a multiple channel configuration? How to select the right channel for every input? It's a bit confusing for me

This topic has been closed for replies.
Best answer by KnarfB

Pins configured as ADC channel are connected to ADC independently of GPIO (digital IO) port and pin numbers. Check the data sheet/ref. manual of your chip (which one?)

hth

KnarfB

1 reply

KnarfB
KnarfBBest answer
Super User
January 4, 2023

Pins configured as ADC channel are connected to ADC independently of GPIO (digital IO) port and pin numbers. Check the data sheet/ref. manual of your chip (which one?)

hth

KnarfB

migmel
migmelAuthor
Associate III
January 5, 2023

Thank you for your response.

Yes, I checked the datasheet and turns out not all ports/pins can be used as ADC input.

They are predefined for each specific MCU.

I was thinking if I use the port A, I could use all 16 pins as ADC input, but the true is I can only use PA0 to PA7 range of pins (STM32F103VCT6) which are channel 0 to 7. Then, the rest of available ADC inputs, are distributed between different ports using different channels(between 8 and 15) to sum up 16 ADC inputs