Reading Analog Input from FRDM-K22F

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading Analog Input from FRDM-K22F

Jump to solution
1,144 Views
xhr1s
Contributor II
Hello, I'm trying to read the value of the A0 pin from the FRDM-K22F development board as an analog input. I have defined it as a input GPIO pin using the pin configuration tool in MCUXpresso. Is this the way to do it? GPIO_ReadPinInput(BOARD_A0_GPIO, BOARD_A0_PORT, BOARD_A0_PIN);
0 Kudos
Reply
1 Solution
1,141 Views
ErichStyger
Specialist I

GPIO_ReadPinInput() reads the pin as digital (high, low) input pin, not as analog pin. I suggest you have a look at the analog examples in the SDK how to configure and read the pin as analog pin?

View solution in original post

0 Kudos
Reply
4 Replies
1,100 Views
xhr1s
Contributor II

So, I still am not able to figure out how to read analog data from an input pin. Which example should I look at?

xhr1s_0-1670514306740.png

Any help is appreciated.

0 Kudos
Reply
1,090 Views
_Leo_
NXP TechSupport
NXP TechSupport

The SDK examples that you can use as a reference are the following:

nxf86756_0-1670969361116.png

 

0 Kudos
Reply
1,142 Views
ErichStyger
Specialist I

GPIO_ReadPinInput() reads the pin as digital (high, low) input pin, not as analog pin. I suggest you have a look at the analog examples in the SDK how to configure and read the pin as analog pin?

0 Kudos
Reply
1,135 Views
xhr1s
Contributor II

Yup. You're right. After reading the documentation at https://mcuxpresso.nxp.com/api_doc/dev/329/group__lpc__gpio.html it is obvious, sorry. It's a bit difficult making sense of the ADC sdk examples, I only need to read one value at a time. The API calls are also not very friendly. Perhaps there is an easier way to do it? I can't seem to figure out any other analog pin read examples.

0 Kudos
Reply