ATD single conversion mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ATD single conversion mode

1,710件の閲覧回数
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
 
ラベル(1)
0 件の賞賛
2 返答(返信)

677件の閲覧回数
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 件の賞賛

677件の閲覧回数
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 件の賞賛