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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

993 Views
abhishekinamdar
Contributor II

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:

pastedImage_18.png

_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.

pastedImage_17.png

Regards

Abhishek

0 Kudos
Reply
4 Replies

684 Views
DavidS
NXP Employee
NXP Employee

Hi Adhishek,

What version of MQX are you using?  MQX_4.1.1 or MQX_4.2?

Both revisions have LWADC example that uses the Potentiometer.

Please compare your code to it.

C:\Freescale\Freescale_MQX_4_1_1_GA\mqx\examples\lwadc

Or

C:\Freescale\Freescale_MQX_4_2\mqx\examples\lwadc

Regards,

David

0 Kudos
Reply

684 Views
abhishekinamdar
Contributor II

Hello David,

     Thanks for the reply, we are using MQX 4_2. We went through the link you mention, tried with the example, still no result. We where not able to understand example clearly and how to read single potentiometer available on the board.

     Do you have any other examples, books or links to go through.?

Thanks and Regards

Abhishek

0 Kudos
Reply

684 Views
DavidS
NXP Employee
NXP Employee

Hi Abhishek,

Sol had good advice.

Please review the C:\Freescale\Freescale_MQX_4_2\doc\MQX_Getting_Started.pdf PDF section 9.14 TWR-K60D100M jumper configurations.

Attached is picture of my TWR-K60D100M and TWR-SER card so you can see my jumper configuration.

Regards,

David

0 Kudos
Reply

684 Views
soledad
NXP Employee
NXP Employee

Hi Adhishek,

This application requires BSPCFG_ENABLE_LWADC defined non-zero in user_config.h. Did you enable it??

In addition please check the below link

MQX RTOS Part 9: Light Weight ADC Driver|Freescale

Regards

Sol

0 Kudos
Reply