Reading Analog Input from FRDM-K22F

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Reading Analog Input from FRDM-K22F

ソリューションへジャンプ
1,141件の閲覧回数
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 件の賞賛
返信
1 解決策
1,138件の閲覧回数
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 件の賞賛
返信
4 返答(返信)
1,097件の閲覧回数
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 件の賞賛
返信
1,087件の閲覧回数
_Leo_
NXP TechSupport
NXP TechSupport

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

nxf86756_0-1670969361116.png

 

0 件の賞賛
返信
1,139件の閲覧回数
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 件の賞賛
返信
1,132件の閲覧回数
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 件の賞賛
返信