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