ADC stopped on KL05Z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ADC stopped on KL05Z

跳至解决方案
1,047 次查看
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

标记 (2)
0 项奖励
1 解答
779 次查看
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 项奖励
4 回复数
779 次查看
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 项奖励
779 次查看
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 项奖励
780 次查看
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 项奖励
779 次查看
nguyennhatminh
Contributor IV

Hi Jorge,

Thank you very much,

You help me solve the problem.

Minh.

0 项奖励