ADC Analog read from the Tower K60 Board pin name AN1 using lwadc

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

ADC Analog read from the Tower K60 Board pin name AN1 using lwadc

755件の閲覧回数
abhishekinamdar
Contributor II

Hello everyone I was trying to read the Analog input (pressure sensor) from the

Pin #:             A29

Pin Name:     AN1

Usage:          PGA1_DP/ADC1_DP0/ADC0_DP3 

I was trying to use lwadc API as used for the onboard potentiometer in MQX intro tutorials. Please go through the following code let me know any mistakes. And also what is the ADC channel number to be allotted for the AN1 for the the API, I have used "ADC0_SOURCE_AD20" please suggest which is the write pin

LWADC_VALUE          press;

LWADC_STRUCT     pot;

#ifdef ADC0_SOURCE_AD20

     {"Pot", ADC0_SOURCE_AD20; };

  #endif

_lwadc_init(&lwadc0_init);

_lwadc_init_input(&pot, ADC0_SOURCE_AD20);

_lwadc_set_attribute(&pot, LWADC_NUMERATOR, 12000);

_lwadc_read(&pot, &press);

_time_delay(200);

タグ(4)
0 件の賞賛
返信
2 返答(返信)

554件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi,

Could you please try using the lwadc example located at the path: C:\Freescale\Freescale_MQX_4_2\mqx\examples\lwadc

This example demonstrates how to read converted values from analogue inputs using lwadc api.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

554件の閲覧回数
abhishekinamdar
Contributor II

Thanks for the replay... I tried with the lwadc but was not able to update the value analog input. So had to try different, Actually got an example (register level) code online and with small changes was able read the ADC value.. Thanks for the help anyways..

0 件の賞賛
返信