ATD single conversion mode

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

ATD single conversion mode

2,232 Views
bitasobhani
Contributor III
Hi all
I am wotking on zigbe 1321x boards.
I want to use 2 ATD channels. Because there is only one ATD, I can't convert both channels at once. I should do a single conversion on the first input, then do a single conversion on the second input and again return to the first input and so on.
My question is about the conversion mode. Should I use single conversion mode or continous mode in this case? If continous mode, how can I do this? and  If single conversion mode, should I use a timer? I know timers on this board can not be less than 4 milliseconds(250Hz).  What should I do for achieving more  sampling frequencies?
THANKS ALOT
 
Labels (1)
0 Kudos
Reply
2 Replies

1,199 Views
seb332
Contributor I
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(;:smileywink:
    {
   
     __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
 
 
 
 
0 Kudos
Reply

1,199 Views
JimDon
Senior Contributor III

Processor Expert will generate a very nice system for this, that will sample the channels.
Recommend you create a separate test project, generate the code and see how it all works.




0 Kudos
Reply