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
762 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
1 Solution
759 Views
ErichStyger
Senior Contributor V

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
4 Replies
718 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
708 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
760 Views
ErichStyger
Senior Contributor V

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
753 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