E128 ATD PAD8+ problem.. help!

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

E128 ATD PAD8+ problem.. help!

862 Views
hex4def6
Contributor I
Hi,

I'm trying to read from the ATD pins PAD8...PAD15, and I'm only getting zeroes. I am able to get data from PAD0...PAD7 however. I've been going through the manual back to back, and I'm stuck. Any suggestions?

Here's my code:

ATD0CTL2 = 0x80; /* Power up A/D, no interrupts */
ATD0CTL3 = 0x40; /* Do eight conversions */
ATD0CTL4 = 0x05; /* 10-bit mode, 7 us/conversion */
ATD0CTL5 = 0x90;

   
while ((ATD0STAT0 & 0x80) == 0 ) ; /* Wait for sequence to finish */

printf("%d %d %d %d %d %d% %d %d %d %d %d %d %d %d% %d %d\r\n",      ATDDR0, ATDDR1, ATDDR2, ATDDR3, ATDDR4, ATDDR5, ATDDR6, ATDDR7, ATDDR8, ATDDR9, ATDDR10, ATDDR11, ATDDR12, ATDDR13, ATDDR14, ATDDR15);

Here's a typical result from the printf line:


517 165 98 317 35 558 75 55 0 0 0 0 0 0 0 0


What am I doing wrong?


Thanks,
Stewart

Labels (1)
0 Kudos
1 Reply

276 Views
DPB
NXP Employee
NXP Employee
Hello

The listed code uses "ATD0CTL3 = 0x40; /* Do eight conversions */"
This ATD0CTL3 setting selects only 8 conversions (as you correctly commented).
To select 16 conversions use ATD0CTL3 = 0x00.
(Refer to Table 6-5 page 214 of the E128 datasheet).

DPB
0 Kudos