Test and Measurement Forum

Saving Overview Buffer in Fast Streaming

Post your C and C++ discussions here

Saving Overview Buffer in Fast Streaming

Postby MarkW » Wed Feb 13, 2013 7:38 am

Hi,

I realise this may be trivial to most but I am running into issues when I try to save the Overview buffer to my own array. Here is my code for my callback function when I run ps2000_get_streaming_last_values:

Code: Select all
void stream(
            short              **overviewBuffers,
            short              overflow,
            unsigned long      trggeredAt,
            short              triggered,
            short              auto_stop,
            unsigned long      nValues
            ){
            //autoStop = auto_stop;
            int j = 0;
            for(j = 0; j < 4; j++){
                  //printf("%d\n", **(overviewBuffers+j));}
            values[j] = **(overviewBuffers+j);}
            no = nValues;
            over = overflow;
           
     }


This code works, however, as soon as I increase the for loop to over 4 iterations the program crashes. My original plan was to loop up to nValues (to store all the values that it has sent). The procedure in the rest of my code is pretty much according to the documentation, and I only call ps2000_get_streaming_last_values once and afterwards close the scope and print the values stored in my values[] array (let me know if I should provide my full code).

An important thing also to note is that I print the values and the first two are correct (the scope probe is hooked up to a 3.3 V DC) but the last two values show -3 (after being converted to 'mV').

Any help would be much appreciated! Thanks!
MarkW
Newbie
 
Posts: 0
Joined: Wed Feb 13, 2013 7:26 am

Re: Saving Overview Buffer in Fast Streaming

Postby MarkW » Wed Feb 13, 2013 9:49 am

I have found my problem which lies in the line:
Code: Select all
values[j] = (**overviewBuffers + j);}


which should be:
Code: Select all
values[j] = *(*overviewBuffers + j);}


What a silly mistake and it took me so long to find it! At least it is something I won't forget in the future!

MY apologies for taking up unnecessary space in the forum.
MarkW
Newbie
 
Posts: 0
Joined: Wed Feb 13, 2013 7:26 am


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests