Unable to read ADC values using processor expert

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

Unable to read ADC values using processor expert

跳至解决方案
600 次查看
jmu
Contributor I

Hello,

I have a question regarding the ADC block in Processor expert. I am using CodeWarrior version 10.6.4 and the microcontroller is part of the MC9S12ZVC family and I am using a USB multilink universal debugger to communicate with the same. In the processor expert it gives me an option to get all the values for the channels configured and store it in an array or read a specific channel. But it looks like only 1 channel is read every single time, when I step into the function it doesn't look like it is even checking for the channel number. 

 

Here is the configuration I am using for my ADC.

164710_164710.pngpastedImage_1.png

 

Below is the code generated by processor expert when I use the AD1_GetChanValue16() function - 

164717_164717.pngpastedImage_2.png

As mentioned it does not seem to use the channel number variable, which leads to me getting the same value no matter what variable I pass.

 

I am calling the AD1_MeasureChan(0) function before calling the Get chan function in polling mode. Am I using the wrong function to read the ADC's ? Also, are there any particular register's that I need to enable for this to work ? 

 

I would deeply appreciate it if someone could throw some light on this matter.

 

Sincerely,

Mahendra

标签 (1)
0 项奖励
1 解答
518 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mahendra,

Thanks for contacting us !

I have checked your question , your ADC component configuration lack of one step about

the "A/D samples":

pastedImage_1.png

After you configure this , you can use the function of "AD1_GetValue" to read ADC result :

pastedImage_2.png

Hope it helps


Have a great day,
Alice

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

在原帖中查看解决方案

2 回复数
519 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mahendra,

Thanks for contacting us !

I have checked your question , your ADC component configuration lack of one step about

the "A/D samples":

pastedImage_1.png

After you configure this , you can use the function of "AD1_GetValue" to read ADC result :

pastedImage_2.png

Hope it helps


Have a great day,
Alice

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

518 次查看
jmu
Contributor I

Thanks a lot Alice! That solved my problem straight away. 

0 项奖励