s12xdp512 ATD1 config for analog inputs

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

s12xdp512 ATD1 config for analog inputs

跳至解决方案
1,331 次查看
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!

标签 (1)
0 项奖励
回复
1 解答
1,187 次查看
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 项奖励
回复
2 回复数
1,187 次查看
seank
Contributor I

Thx!

0 项奖励
回复
1,188 次查看
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 项奖励
回复