TI中文支持网
TI专业的中文技术问题搜集分享网站

CC1350ADCBUF 采集数据切换通道

在切换通道前必须加延时才能切换,不进行延时切换通道不能成功

ADCBuf_close(adcBuf);
                    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
                    continuousConversion[0].arg = NULL;
                    continuousConversion[0].sampleBuffer = sampleBufferOne;  //LWS note u16 accord with sample counts ADCBUFFERSIZE
                    continuousConversion[0].sampleBufferTwo = sampleBufferTwo;
                    continuousConversion[0].samplesRequestedCount = ADCBUFFERSIZE;
                    continuousConversion[0].adcChannel = Board_ADCBUF0CHANNEL2;
                    if (ADCBuf_convert(adcBuf, &continuousConversion[0], 1) !=
                            ADCBuf_STATUS_SUCCESS) {
                            /* Did not start conversion process correctly. */
                            while(1);
                        }
                    sleep(1);
                    ADCBuf_close(adcBuf);
                    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
                    continuousConversion[1].arg = NULL;
                    continuousConversion[1].sampleBuffer = sampleBufferOne;  //LWS note u16 accord with sample counts ADCBUFFERSIZE
                    continuousConversion[1].sampleBufferTwo = sampleBufferTwo;
                    continuousConversion[1].samplesRequestedCount = ADCBUFFERSIZE;
                    continuousConversion[1].adcChannel = Board_ADCBUF0CHANNEL3;
                    if (ADCBuf_convert(adcBuf, &continuousConversion[1], 1) !=
                            ADCBuf_STATUS_SUCCESS) {
                            /* Did not start conversion process correctly. */
                            while(1);
                        }
                    sleep(1);
               
                    ADCBuf_close(adcBuf);
                    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
                    continuousConversion[2].arg = NULL;
                    continuousConversion[2].sampleBuffer = sampleBufferOne;  //LWS note u16 accord with sample counts ADCBUFFERSIZE
                    continuousConversion[2].sampleBufferTwo = sampleBufferTwo;
                    continuousConversion[2].samplesRequestedCount = ADCBUFFERSIZE;
                    continuousConversion[2].adcChannel = Board_ADCBUF0CHANNEL4;
                    if (ADCBuf_convert(adcBuf, &continuousConversion[2], 1) !=
                            ADCBuf_STATUS_SUCCESS) {
                            /* Did not start conversion process correctly. */
                            while(1);
                        }
                    sleep(1);
         
                    ADCBuf_close(adcBuf);
                    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
                    continuousConversion[3].arg = NULL;
                    continuousConversion[3].sampleBuffer = sampleBufferOne;  //LWS note u16 accord with sample counts ADCBUFFERSIZE
                    continuousConversion[3].sampleBufferTwo = sampleBufferTwo;
                    continuousConversion[3].samplesRequestedCount = ADCBUFFERSIZE;
                    continuousConversion[3].adcChannel = Board_ADCBUF0CHANNEL5;
                    if (ADCBuf_convert(adcBuf, &continuousConversion[3], 1) !=
                            ADCBuf_STATUS_SUCCESS) {
                            /* Did not start conversion process correctly. */
                            while(1);
                        }
                    sleep(1);
去除sleep(1)则不能切换成功,这样采样率就太低了,该如何让解决呢
Kevin Qiu1:

切换需要一段延时,你想实现多大的采样率

zhenzhe piao:

回复 Kevin Qiu1:

1khz,请问这个延时最小是多少

zhenzhe piao:

回复 Kevin Qiu1:

这个最小延时没有答案么???

YiKai Chen:

回复 zhenzhe piao:

我記得我在 e2echina.ti.com/…/589295 給過你範例程式,也測試過切換ADC channel並不需要sleep

Kevin Qiu1:

回复 zhenzhe piao:

1KHz的采样率并不算高,延时的话可以用微秒延时usleep( )试一下

zhenzhe piao:

回复 Kevin Qiu1:

刚刚试了一下不行的,usleep(0.01);还是只读取第一个通道的数据,没有切换通道

Kevin Qiu1:

回复 zhenzhe piao:

里面是常整型的数据类型,你要延时0.01微秒?

zhenzhe piao:

回复 Kevin Qiu1:

我尝试了一下通道切换的延时最低是0.01s这样的话,这个采样率是达不到1000hz的,我想问一下adcsinglechannel例程的采样率是多少,能否满足要求

Kevin Qiu1:

回复 zhenzhe piao:

例程中设置的是200Hz,最大可以达到10000Hz,延时大的话建议你用DMA的方式

zhenzhe piao:

回复 Kevin Qiu1:

DMA方式未看到例程,能否给一个

赞(0)
未经允许不得转载:TI中文支持网 » CC1350ADCBUF 采集数据切换通道
分享到: 更多 (0)