Hello bitasobhani,
You should use single conversion mode and then you can launch a conversion each time you want (once you select one of yor 2 channels : for that, a conversion occurs each time you set ATD1SC in single conversion mode).
In continious conversion mode, a conversion occurs at each step of the program at tthe highest speed of the ATD on the same channel until you change it, so more supply current is needed.
You don't need to use use timer because in single mode once CCF flags is set it is automaticaly cleared after that.
I hope I have answered some your questions.
To help, i can give a programm. Sadly, It is using only one channel.
void ADC_INI(void)
{
ATD1PE = 1;
ATD1C=0x80;
ATD1SC_ATDIE = 0;
ATD1SC_ATDCO = 0;
ATD1SC_ATDCH = 0;
}
void ADC_INI(void);
void main(void)
{
PTDDD = 0xFF;
PTDD = 0x00;
for(;
{
__RESET_WATCHDOG(); /* feeds the dog */
ADC_INI();
if(ATD1R <= 32768)
{
PTDD_PTDD0 = 1;
PTDD_PTDD1 = 1;
PTDD_PTDD3 = 1;
PTDD_PTDD4 = 1;
}
if(ATD1R > 32768)
{
PTDD_PTDD0 = 0;
PTDD_PTDD1 = 0;
PTDD_PTDD3 = 0;
PTDD_PTDD4 = 0;
}
}
Regards,
seb332