AnsweredAssumed Answered

Codewarrior MQX RTOS project, to get ADC value from the TWR-K60D100M potentiometer

Question asked by Abhishek Inamdar on Jul 8, 2015
Latest reply on Jul 13, 2015 by David E Seymour

Hello,

 

     We where working on TWR-K60D100M on CodeWarrior v10.6.4 software, for the MQX RTOS project. In this project we where trying to read on the Potentiometer available on the board(R50), using the following code:

 

 

_lwadc_init(&BSP_DEFAULT_LWADC_MODULE);/*to initialise the ADC*/

_lwadc_init_input(&pot, BSP_ADC_POTENTIOMETER);/*initialize the data structure for the input to this ADC Device; declaring the pot*/

_lwadc_set_attribute(&pot, LWADC_NUMERATOR, 12000);/*Num/Den*/

 

LWADC_STRUCT          pot;                    /*Initializing the variable*/

LWADC_VALUE             pressure;          /*Initializing the variable*/

_lwadc_read(&pot, &voltage)                   /*storing the value read from 'pot' into 'pressure'*/

 

 

     Please, go through the code and let us know what is wrong, or any other codes we can us to get the value from the Potentiometer.? Below is the screen shot, when we where Debugging the project, we can observe that the variables pot and pressure value where not changing. Tried by placing the break point at all the places, programming was running fine but it was not getting the value from the potentiometer.

 

 

Regards

Abhishek

Outcomes