AnsweredAssumed Answered

porting problem from dp256 to xdt256! thanks for help!

Question asked by zheng xuguang on Jun 18, 2009
Latest reply on Jun 18, 2009 by kef

as we all know s12dp256 has two ATD modules --  ATD1 and ATD0, but in the mc9s12xdp512v2.pdf document, it says that 112-pin package has no ATD0 module, it only has one 16 channel ATD1 module, my problems is :

      my previous s12dp256 project code as follows:

void  InitialATD(void)
{
    ATD1CTL2 = 0xc0;       // power on atd module fast flag clear mode
    ATD1CTL3 = 0x00;       // single channel 8 results each sequence
    ATD1CTL4 = 0x80;       // 8bits 2sample clock atd module clock 2MHz

    ATD0CTL2 = 0xc0;       // power on atd module fast flag clear mode
    ATD0CTL3 = 0x00;       // single channel 8 results each sequence
    ATD0CTL4 = 0x80;       // 8bits 2sample clock atd module clock 2MHz
}

 

unsigned char GetPos(void)
{
    

   ATD0CTL5 = 0x81;      // AN1; unsigned; right aligned; single conversion; one channel
   
    __asm nop;
    __asm nop;
    while(ATD0STAT0_SCF == 0);
   
    return ATD0DR0L ;   

}

 

this code can run in s12xdt256 correctly, this mcu in 112 pin package has only one 16 channel ATD1 module, why the code can run correctly?

                                   thanks for help! 

Outcomes