AnsweredAssumed Answered

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

Question asked by Abhishek Inamdar on Nov 24, 2015
Latest reply on Nov 27, 2015 by Abhishek Inamdar

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);

Outcomes