ATD module could be configured for three basic measurement:
- Single conversion - One sample at one channel OR
- Multiple samples at one channel OR
- One sample on multiple channels
Result from ATD conversion are stored into ATDDR0..ATDDRx register(s).
There isn’t any direct connection between port AD numbering and ATDDR result register numbering.
When FIFO=0 (default), sequence results of measurement are stored into ATDDR0, ATDDR1,….ATDDRn registers.
For example: we setup ATD to measure one sample at multiple channels (MULT=1), number of channels =4 (S8C=0, S4C=1, S2C=0, S1C=0), and we starts from Internal_2 channel (ATDCTL5=0x58). After that, Internal_2 result will be stored into ATDDR0 and Internal_5 result will be stored into ATDDR3.
If we want measure voltage at all HVI inputs (Internal_5 channel), we cannot use configuration for multiple channels. We have to use single conversion or multiple samples at one channel (MULT=0). So, only way is set PTAL1, PTAL0 bits, write ATDCTL5, wait for result, change PTAL1, PTAL0 bits, write ATDCTL5, ....