打印
[DSP编程]

ADC级联过采样模式测试

[复制链接]
854|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
huweili|  楼主 | 2014-10-23 22:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ADC级联过采样模式中的测试程序为什么要这样写呢?   
for (i=0; i<(BUF_SIZE/16); i++)
     {
       // Wait for int1
       while (AdcRegs.ADCST.bit.INT_SEQ1== 0){}//等待本次序列结束
       GpioDataRegs.GPASET.bit.GPIO0 = 1;  // Set GPIO60 for monitoring  -optional

       AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;  //清除中断信号

#if INLINE_SHIFT       //当数据从结果寄存器中取出时的移动结果
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT0)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT1)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT2)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT3)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT4)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT5)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT6)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT7)>>4);

#endif //-- INLINE_SHIFT

#if NO_SHIFT || POST_SHIFT

       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT0));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT1));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT2));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT3));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT4));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT5));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT6));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT7));

#endif //-- NO_SHIFT || POST_SHIFT

       while (AdcRegs.ADCST.bit.INT_SEQ1== 0){}
           GpioDataRegs.GPACLEAR.bit.GPIO0 = 1;  // Clear GPIO0 for monitoring  -optional
       AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;

#if INLINE_SHIFT

       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT8)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT9)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT10)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT11)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT12)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT13)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT14)>>4);
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT15)>>4);

#endif //-- INLINE_SHIFT

#if NO_SHIFT || POST_SHIFT

       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT8));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT9));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT10));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT11));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT12));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT13));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT14));
       SampleTable[array_index++]= ( (AdcRegs.ADCRESULT15));
#endif // -- NO_SHIFT || POST_SHIFT

        }


#if POST_SHIFT
    // For post shifting, shift the ADC results
    // in the SampleTable buffer after the buffer is full.
    for (i=0; i<BUF_SIZE; i++)
    {
      SampleTable[i] = ((SampleTable[i]) >>4);
    }

相关帖子

沙发
NWPU_CHEN| | 2014-10-24 13:19 | 只看该作者
不知你问的是哪怎样写,那你觉得应该怎样写?问问题模糊不清啊

使用特权

评论回复
板凳
huweili|  楼主 | 2014-10-25 10:51 | 只看该作者
NWPU_CHEN 发表于 2014-10-24 13:19
不知你问的是哪怎样写,那你觉得应该怎样写?问问题模糊不清啊

为什么要分几种情况写呢,直接用16个存储器不得吗

使用特权

评论回复
地板
NWPU_CHEN| | 2014-10-25 13:33 | 只看该作者
huweili 发表于 2014-10-25 10:51
为什么要分几种情况写呢,直接用16个存储器不得吗

那你就应该问问写程序的人了,两次中断触发进行十六通道采样的用意了,也许那个写程序的就喜欢这么干呢?这种东西,外人捉摸不透,每个人的编程风格都不一样,别人程序就是参考,失去自己的风格才是可怕的!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

4

主题

8

帖子

1

粉丝