s12xdp512 ATD1 config for analog inputs

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

s12xdp512 ATD1 config for analog inputs

Jump to solution
554 Views
seank
Contributor I

Hi,

I’m using the 112 pin version of the xdp512 mcu and seem to be unable to successfully configure the second ATD module.  All 8 channels of the first module seem to work just fine, but when I try to read a register from the second module I get the same static result.

 

My init code is as follows:

void initADC(){

  

    ATD0DIEN = ZEROS;

    ATD1DIEN0 = ZEROS;

    ATD1DIEN1 = ZEROS;

    /* And configure them all for analog input */

    ATD0CTL0 = 0x07;

    //ATD0CTL1 = 0x07/* Trigger and interrupt configuration, unused for now. */

    ATD0CTL2 = 0xC0;

    ATD0CTL3 = 0x40;

    ATD0CTL4 = 0x73;

    ATD0CTL5 = 0xB0;

 

    /* And configure them all for analog input */

    ATD1CTL0 = 0x07;

    //ATD0CTL1 = 0x07/* Trigger and interrupt configuration, unused for now. */

    ATD1CTL2 = 0xC0;

    ATD1CTL3 = 0x40;

    ATD0CTL4 = 0x73;

    ATD0CTL5 = 0xB0;

}


My code reads it just like this:

result = ATD1DR2;


Any input would be appreciated!

Labels (1)
0 Kudos
1 Solution
410 Views
RadekS
NXP Employee
NXP Employee

I think that there is just issue with copy&paste code (see my comment)

    ATD1CTL0 = 0x07;

    //ATD0CTL1 = 0x07/* Trigger and interrupt configuration, unused for now. */

    ATD1CTL2 = 0xC0;

    ATD1CTL3 = 0x40;

    ATD0CTL4 = 0x73;  //please change to ATD1CTL4 = 0x73;

    ATD0CTL5 = 0xB0;  //please change to ATD1CTL5 = 0xB0;


View solution in original post

0 Kudos
2 Replies
410 Views
seank
Contributor I

Thx!

0 Kudos
411 Views
RadekS
NXP Employee
NXP Employee

I think that there is just issue with copy&paste code (see my comment)

    ATD1CTL0 = 0x07;

    //ATD0CTL1 = 0x07/* Trigger and interrupt configuration, unused for now. */

    ATD1CTL2 = 0xC0;

    ATD1CTL3 = 0x40;

    ATD0CTL4 = 0x73;  //please change to ATD1CTL4 = 0x73;

    ATD0CTL5 = 0xB0;  //please change to ATD1CTL5 = 0xB0;


0 Kudos