This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AD循环采样几次后采样停止工作,为什么?



程序内容为,首先采集ADCINA0通道的数,处理完数据后再同时采集ADCINA0ADCINB0的数,处理完两个通道的数据后,再采集ADCINA0通道的数,处理完数据后再。。。这样循环采样。我发现循环采样两三次后,程序停止,停止在
while(AdcRegs.ADCST.bit.INT_SEQ1==0){}
 程序相关程序如下:
InitAdc();
 
         AdcRegs.ADCTRL3.bit.ADCCLKPS=0x00;
 
         AdcRegs.ADCTRL1.bit.ACQ_PS=0x01; //adclk/(1+1+1)=15/3=7.5MHz
 
         AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;       
         AdcRegs.ADCTRL3.bit.SMODE_SEL=0;       //顺序采样,最大转换数为1
   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x00;
 
   AdcRegs.ADCTRL1.bit.CONT_RUN = 1;     
 
   AdcRegs.ADCTRL1.bit.SEQ_OVRD = 1;     
 
   AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0x00;
ls=0;
flag=1;
AdcRegs.ADCTRL2.all=0x2000;
for (;;)
         {
                   while(AdcRegs.ADCST.bit.INT_SEQ1==0)  //循环采样几次后程序停止在这里
                   {}
        
                   AdcRegs.ADCST.bit.INT_SEQ1_CLR=1;
                   if(ls==0)
                   {
                   SampleTable1[array_index++]=((AdcRegs.ADCRESULT0)>>4);
        }
                   if(ls==1)
                   {
                   SampleTable1[array_index]=((AdcRegs.ADCRESULT0)>>4);
                   SampleTable2[array_index]=((AdcRegs.ADCRESULT1)>>4);
        array_index++;
        }
        
                   DELAY_US(sr_tl);
if (array_index>=SL_ecg)
                   {
                            array_index=0;
                                     if (flag==1)
                             {
 
                                     k_rs=1;
                            }
                            If(flag==0)
{
                      k_rs=0;
}
 
if(k_rs==1)
                            {
                                     flag=0;
                    AdcRegs.ADCTRL1.bit.SEQ_CASC = 0;        // 1  Cascaded mode
                         AdcRegs.ADCTRL3.bit.SMODE_SEL=1;       // sequence sampling
                                               AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x00;
                                       
                                               ls=1;
                                              
                              }
 
                          if(k_rs==0)
                                     {
                                          flag=1;
                                               AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;        // 1  Cascaded mode
                         AdcRegs.ADCTRL3.bit.SMODE_SEL=0;       // sequence sampling
                                               AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x00;
                                              
                                               ls=0;
                                      }
 
}