Can not able to read valid data in buffer....!!!

Post your C and C++ discussions here
Post Reply
umesh.lokhande
Newbie
Posts: 0
Joined: Fri Dec 14, 2012 1:39 pm

Can not able to read valid data in buffer....!!!

Post by umesh.lokhande »

Hello,
i am writing application to read voltage from PicoScope Model: 3206. Since from couple of days i am trying to read buffer from Channel A. but cant able to get valid data in buffer. Technical details are as follows,

At very first i want to read from channel A and without any triggering input. I only want to check functionality from this implementation. The sequence of function in my source file are as follows,

ps3000_open_unit();

ps3000_set_channel(psHandler, PS3000_CHANNEL_A, TRUE, TRUE, PS3000_100MV);

ps3000_set_trigger(psHandler, PS3000_NONE, 16400, PS3000_RISING, 0, 0);

ps3000_get_timebase(psHandler, 1, 1000, &time_interval, &time_units, 1, &max_sample);

ps3000_run_block(psHandler, 1000, 1, 1, &time_indisposed_ms);

ps3000_ready(psHandler);

ps3000_get_values(psHandler, &buffer_a[0], 0, 0, 0, &overflow, 1000);

Here in "buffer_a[0]", i expected to have some data, But could not get which parameter in my application is going wrong

Awaiting kind rely.

Thanks

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Can not able to read valid data in buffer....!!!

Post by Martyn »

Can you post your code so that we can see the functional logic as well as the api calls, or can you try the PS3000Con.c code that is supplied with the sdk.
Martyn
Technical Support Manager

umesh.lokhande
Newbie
Posts: 0
Joined: Fri Dec 14, 2012 1:39 pm

Re: Can not able to read valid data in buffer....!!!

Post by umesh.lokhande »

Hello Martyn,
Thank you for your reply.....here is my code. What i don't understand here is every function works fine but the Buffer always shows some garbage value.....I hope this code is enough for you to figure it out which parameter from my implementation is going wrong......!!!

Thanks in Adavnce...!!!

Code: Select all

#include "pico_scope.h"


PicoScope::PicoScope(QObject *parent) :
    QObject(parent)
{

}

int32_t PicoScope::openScope()
{
    short status;

    long time_interval;
    short time_units;
    long max_sample;
    long time_indisposed_ms;

    psHandler = ps3000_open_unit();

    if (psHandler <= 0)
        return(PS_OPEN_FAILED);

    status = ps3000_set_channel(psHandler, PS3000_CHANNEL_A, TRUE, TRUE, PS3000_100MV);

    if (status != 1)
        return(PS_SET_CHANNEL_FAILED);

    status = ps3000_set_trigger(psHandler, PS3000_NONE, 16400, PS3000_RISING, 0, 0);

    if (status != 1)
        return(PS_SET_TRIGGER_FAILED);

    status = ps3000_get_timebase(psHandler, 1, 1000, &time_interval, &time_units, 1, &max_sample);

    if (status != 1)
        return(PS_GET_TIMEBASE_FAILED);

    status = ps3000_run_block(psHandler, 1000, 1, 1, &time_indisposed_ms);

    if (status != 1)
        return(PS_RUN_BLOCK_FAILED);

    return (PS_NO_ERROR);
}

int32_t PicoScope::ReadScope()
{
    short status;
    short buffer_a[1000];
    short overflow;

    status = ps3000_ready(psHandler);

    if (status != 1)
        return(PS_READY_FAILED);

    status = ps3000_get_values(psHandler, &buffer_a[0], 0, 0, 0, &overflow, 1000);

    if (status == 0)
        return(PS_GET_VALUES_FAILED);

    qDebug()<<"Values from Channel a0 : "<< buffer_a[0];

    status = ps3000_stop(psHandler);

    if (status != 1)
        return(PS_STOP_FAILED);

    return (PS_NO_ERROR);

}

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Can not able to read valid data in buffer....!!!

Post by Martyn »

Have you got an example of the data you collect, even if you think it is garbage ?
Martyn
Technical Support Manager

umesh.lokhande
Newbie
Posts: 0
Joined: Fri Dec 14, 2012 1:39 pm

Re: Can not able to read valid data in buffer....!!!

Post by umesh.lokhande »

Yes, in my buffer i got some random repetative numbers and very often are 0, 260, 520 etc,

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Can not able to read valid data in buffer....!!!

Post by Martyn »

What signal are you feeding into the scope, and what data would you expect to see in the buffer ?
Martyn
Technical Support Manager

umesh.lokhande
Newbie
Posts: 0
Joined: Fri Dec 14, 2012 1:39 pm

Re: Can not able to read valid data in buffer....!!!

Post by umesh.lokhande »

Hello Martyn,

I want to set channel A of Picoscope 3206 by external 5v DC input from power supply without any trigger input. I want to get this equivalet data of 5v in my buffer. Once i am sure that i have right data into buffer futhermore i want to plot this voltage on Graph. But I have got lot more difficulties just to set parameters and make it work.....!!!

I ask you pls if possible guide me some steps to configure PS3206(Function calls) in Block mode to read external input voltage from channel A to buffer so that I will use this content of buffer for further processing.

Awaiting your kind reply

Thanks in Advance

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Can not able to read valid data in buffer....!!!

Post by Martyn »

Are you actually feeding in 5V when you get the values 0, 260, 520 as you have set the channel up to the 100mV range as per the following line

Code: Select all

ps3000_set_channel(psHandler, PS3000_CHANNEL_A, TRUE, TRUE, PS3000_100MV)
If not and there is nothing connected then what you are seeing is probably just noise and perfectly normal adc counts for our scope.

You can convert to volts by using

Code: Select all

( adc_count * input_range ) / 32767
Martyn
Technical Support Manager

umesh.lokhande
Newbie
Posts: 0
Joined: Fri Dec 14, 2012 1:39 pm

Re: Can not able to read valid data in buffer....!!!

Post by umesh.lokhande »

Hello Martyn,
All works fine now exactly the way i wanted.
Thank you very much for your time to time replies.

Regards,
Umesh

Post Reply