Test and Measurement Forum

oscilloscope channel DrDAQ

Post your C and C++ discussions here

oscilloscope channel DrDAQ

Postby greyvvolf » Thu Jun 21, 2012 1:39 pm

Hi,
I have a problem with communication with oscilloscope channel in DrDAQ. I'm working with builder C++ and i use data collection in single mode.I don't have problems with other channels but channel nr 4 (oscylloscope) doesn't work. I use tutorial from pico website and documentation.
greyvvolf
Newbie
 
Posts: 0
Joined: Mon Sep 19, 2011 1:54 pm

Re: oscilloscope channel DrDAQ

Postby Hitesh » Thu Jun 21, 2012 2:32 pm

Hi grevvolf,

Does the oscilloscope channel work when you enable it in the PicoScope software?

Please send in your code and we can take a look.

Thanks,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2008
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: oscilloscope channel DrDAQ

Postby greyvvolf » Mon Jun 25, 2012 8:24 am

Yes, oscilloscope channel work with picoscope. Function with streaming mode:

Code: Select all
bool TdrDaq::CollectStream(int nr_ch){
        unsigned int i;
        short nChannels = 1;    //1
        unsigned long nSamples = 100000;
        unsigned long nSamplesPerChannel = 100000;
        unsigned long nSamplesCollected;
        short samples[100000];
        unsigned long usForBlocks =100000;    //10000
        unsigned long triggerIndex = 0;
        short nLines=0;
        short isReady;
        int licznik = 0;
        USB_DRDAQ_INPUTS channel = USB_DRDAQ_CHANNEL_SCOPE;//(4)
        time_start = timeGetTime();
        m_statusDAQ = UsbDrDaqSetTrigger(m_handleDAQ,FALSE,0,0,0,0,0,0,0);   
        m_statusDAQ = UsbDrDaqSetInterval(m_handleDAQ,&usForBlocks,nSamples,&channel,nChannels);     
        m_statusDAQ = UsbDrDaqRun(m_handleDAQ,nSamples,BM_SINGLE);   

        isReady=0;
        while(isReady == 0){
                m_statusDAQ = UsbDrDaqReady(m_handleDAQ,&isReady);
        }
        while(licznik < 1){
                nSamplesCollected = nSamplesPerChannel;
                m_statusDAQ = UsbDrDaqGetValues(m_handleDAQ,samples,&nSamplesCollected,&m_overflowDAQ,&triggerIndex);
                if(nLines == 20) nLines = 0;
                else nLines++;

                for(i=0;i<nSamplesCollected;i++){

                        if(nr_ch== USB_DRDAQ_CHANNEL_SCOPE){   
                                adc_to_mv(&samples[i]);
                                m_tabValueDAQ.push_back(samples[i]);
                        }                     
                }
                licznik++;
        }

        m_statusDAQ = UsbDrDaqStop(m_handleDAQ);
        time_stop = timeGetTime();
        //time_stop = GetTime();
        return true;
}


for other channel it's work great.
greyvvolf
Newbie
 
Posts: 0
Joined: Mon Sep 19, 2011 1:54 pm

Re: oscilloscope channel DrDAQ

Postby Hitesh » Tue Jun 26, 2012 3:28 pm

Hi,

What is the specific error you are getting?

If you are looking to collect data in streaming mode, you need to change BM_SINGLE to BM_STREAM in the call to UsbDrDaqRun:

Code: Select all
m_statusDAQ = UsbDrDaqRun(m_handleDAQ, nSamples, BM_STREAM); 


Also, the channel variable might need to be declared as an array, even though it has a single element.

Best wishes,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2008
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests