AnsweredAssumed Answered

ATD1 Channel 0-7 conversion not happening with MC9S12XDP512MAG

Question asked by santhosh sl on Mar 22, 2013
Latest reply on Mar 25, 2013 by santhosh sl

Hello

 

We are using MC9S12XDP512MAG MCU for our development.

Currently we are using ADC10,11,12 in our project and for this we have following Control register values

    ATD1CTL0 = 0x0f;  // wrap around to AN0 after conv AN15

    ATD1CTL2 = 0x80;  // no interrupt, normal ATD functionality in power down mode

    ATD1CTL3 = 0x22;//0x1A;  // 4 conversions per sequence                              

    ATD1CTL4 = 0x47;  // 0x5f;  // bus clock divide by 16,           

    ATD1CTL5 = 0xB2;  // sample across several channels, unsigned and right justified, select channel 10 as Starting channel for seq 4 conversion

 

All other control register details were correct except for the ATD1CTL5. For which according to Data sheet, "BA" should be the value if you want a Multi channel (Seq 4) conversion with "A = An10" as a starting channel for conversion. But if you see the value i am using, it is B2. After doing manually checking the conversion data for each channel, i got this value. Writing which will make starting channel of conversion sequence as An10.

 

And now we want to move from this MCU to a 80 pin MCU MC9S12XDG128MAA and this doesnot have ADC's from An8 to An15. So wanted to use ADC1-3.

But when i am trying to get the ATD1CTL5 value for making An1/An0 channel as starting channel for conversion, i am seeing that what ever value I give in the lower nibble of ATD1CTL5, I am not seeing data read from ADC channels 0-7.

 

I just tried following chunk of code to read converted values from each ADC channel and did single step but couldnot read any of the ADC channels from An0-7.

 

main() {

int i=0;

    ATD1CTL0 = 0x0f;  // wrap around to AN0 after conv AN15

    ATD1CTL2 = 0x80;  // no interrupt, normal ATD functionality in power down mode

    ATD1CTL3 = 0x22;//0x1A;  // 4 conversions per sequence                              

    ATD1CTL4 = 0x47;  // 0x5f;  // bus clock divide by 16,           

    for (i=0;i<15;i++)

    {

         ATD1CTL5 = 0xA0 | i ;

    }

}

 

Some one help me in getting this issue resolved.

 

Also please let me know if the Documentation for ATD1CTL5 register is wrong in Data Sheet.

 

 

Outcomes