Jump to content

Configuring GPIO as an ADC at TM4C123GXL

Recommended Posts

I am using the current sensor HO 10-P with my TM4C123 launchpad board.


Essentially I have to connect the Vout pin to a GPIO, configure the GPIO as an ADC pin and then configure the ADC controller to read the Vout from the sensor. I will connect the Vout to PE2 (which is AIN2 and also a GPIO).


Wondering how to configure this GPIO as an ADC and then read it? Can you show a sample code snippet?

Share this post

Link to post
Share on other sites

// stuff here like global variables and constants

const int analogInputPin = 28;

// PE2 on the chip, A1 in Energia, Pin 28 on the headers

// defined here to make it easier to re-assign the pin if

// needed later


int a = 0;


void setup()


// more stuff here



void loop()


// do things

a = analogRead(analogInputPin);

// do other things


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now