ps2000_run_block not working in a loop

Discussion forum for the Picoscope 6 Linux software
Post Reply
bwbarco
Newbie
Posts: 0
Joined: Tue Oct 03, 2017 9:12 am

ps2000_run_block not working in a loop

Post by bwbarco »

flag is 1 the first time, but fails the second time ( remains 0 )
ps2000_stop ( unitOpened.handle );
}
-->
We want to acquire a sine wave 1KHz audio signal over a longer period of time.
This is achieved by running ps2000_run_block in a loop until the time has expired.
After setting up the acquisition, timebase and trigger, the loop below is executed.

The first run, it works fine: ps2000_ready returns 1 as expected. The data is collected and processed.
The second run, ps2000_ready keeps returning 0, making the loop hang - unless a key is pressed.

This is code I inherited, so it looks OK to me -- according the documentation of ps2000_run_block.
Any ideas what we are doing wrong?

I had to cut the code real short, due to some blocking mechanism on this forum that did not allow me to paste the full code in a code block:

while ()
{
ps2000_run_block ( unitOpened.handle, no_of_samples, timebase, oversample, &time_indisposed_ms );
flag = ps2000_ready ( unitOpened.handle ); --> flag is 1 the first time, but fails the second time ( remains 0 )
ps2000_stop ( unitOpened.handle );
}