AnsweredAssumed Answered

Unable to read ADC values using processor expert

Question asked by Mahendra Upadhyaya on Sep 19, 2016
Latest reply on Sep 20, 2016 by Mahendra Upadhyaya

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.

 

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

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

Outcomes