Unable to read ADC values using processor expert

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

Unable to read ADC values using processor expert

Jump to solution
583 Views
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

Labels (1)
0 Kudos
1 Solution
501 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

2 Replies
502 Views
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!
-----------------------------------------------------------------------------------------------------------------------

501 Views
jmu
Contributor I

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

0 Kudos