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!
已解决! 转到解答。
No, XDT256 has two ATD modules, 8 channels module ATD0 and 16 channels ATD1 module. 112pins package has bounded out all 8 ATD0 channels and first 8 ATD1 channels. Pin numeration is confusing. PAD00 to PAD07 are ATD0 pins, PAD08 to PAD15 are ATD1 pins. PAD09 to PAD23 are ATD1 pins, but these are not accessible on 112pin package.
It would be way less confusing if ATD1 had pins PAD10, PAD11, .. PAD1A ..PAD1F or something, clearly saying that specific pin belongs to ATD0 or to ATD1. Or PAD100 to PAD115 in case hex is taboo.
(I hope you aren't using very first maskset like M42E. On M42E there was single 16 channels ATD1 module with pins PAD00 to PAD15.)
No, XDT256 has two ATD modules, 8 channels module ATD0 and 16 channels ATD1 module. 112pins package has bounded out all 8 ATD0 channels and first 8 ATD1 channels. Pin numeration is confusing. PAD00 to PAD07 are ATD0 pins, PAD08 to PAD15 are ATD1 pins. PAD09 to PAD23 are ATD1 pins, but these are not accessible on 112pin package.
It would be way less confusing if ATD1 had pins PAD10, PAD11, .. PAD1A ..PAD1F or something, clearly saying that specific pin belongs to ATD0 or to ATD1. Or PAD100 to PAD115 in case hex is taboo.
(I hope you aren't using very first maskset like M42E. On M42E there was single 16 channels ATD1 module with pins PAD00 to PAD15.)