ADC stopped on KL05Z

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

ADC stopped on KL05Z

Jump to solution
1,010 Views
nguyennhatminh
Contributor IV

Hi guy,

 

I'm practicing on ADC by using PE.

 

Please see attached file for my project.

 

The problem is can't see the "value " variable when i click " run".

 

if I want to see the value I must set the break point at end of loop.

for(;;){

     AD1_MeasureChan(1,0);

     AD1_GetChanValue16(0,&value);

  }

 

I set 12 bits resolution but the result shows me in 16 bits.

 

Please help me point out what the problem is ?

thank you ,

Minh.

Original Attachment has been moved to: ADC-by-PE.rar

Tags (2)
0 Kudos
1 Solution
742 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Nguyen:

If you want to see a variable while running, this only works for global variables, not local variables, and you need to select the option "Refresh While Running". For details check the next tutorial:

Live View for Variables and Memory | MCU on Eclipse

Regarding the 16 bit result, this is normal because you are calling the AD1_GetChanValue16() method, which performs a bit shift. To obtain the real 12 bit result you should instead use the AD1_GetChanValue() method, just enable it from the "Methods" tab in Processor Expert.

Hope this helps clarifying!


Regards!,
Jorge Gonzalez

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

View solution in original post

0 Kudos
4 Replies
742 Views
perlam_i_au
Senior Contributor I

Hello Nguyen:

I have downloaded your code and I was able to reproduce the error, I am still looking for a possible cause but so far at this moment I have not found something definitive. On the reference manual I found that default clock source for ADC module is the OSCERCLK but only when this is working on MHz range, could you please confirm what clock configuration are you using?.

Another thing would be the power modes, if I am right you are not changing from normal RUN mode, but please confirm if this is the case. If not (if you are entering to another power modes) please see table below.

KL05.JPG.jpg

I am still looking for more information


Have a nice day,
Perla Moncada

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

0 Kudos
742 Views
nguyennhatminh
Contributor IV

Hi Perla Moncade,

Thank you very much for your reply,

The clock is FEI mode,

Enable low power mode.

Thanks,

Minh

0 Kudos
743 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Nguyen:

If you want to see a variable while running, this only works for global variables, not local variables, and you need to select the option "Refresh While Running". For details check the next tutorial:

Live View for Variables and Memory | MCU on Eclipse

Regarding the 16 bit result, this is normal because you are calling the AD1_GetChanValue16() method, which performs a bit shift. To obtain the real 12 bit result you should instead use the AD1_GetChanValue() method, just enable it from the "Methods" tab in Processor Expert.

Hope this helps clarifying!


Regards!,
Jorge Gonzalez

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

0 Kudos
742 Views
nguyennhatminh
Contributor IV

Hi Jorge,

Thank you very much,

You help me solve the problem.

Minh.

0 Kudos