PS5000 multiple-record

Post general discussions on using our drivers to write your own software here
Post Reply
akisugita
User
User
Posts: 4
Joined: Fri Oct 12, 2007 5:48 am

PS5000 multiple-record

Post by akisugita »

Hello!

I want to develop the LabVIEW program using Picosope 5203, and realize the multiple-record function using the memory segment which the digitizer of NI or GaGe has.

Would you tell me whether the following codes are right which realizes multiple-record?
Although ps5000GetValues was used in following codes, should ps5000GetValuesAsync and ps5000DataReady be used?

Thanks in advance
Akihiro

/************************************************************
* My sample code of multiple-record part using the memory segments
***********************************************************/

/************************************************************
* Memory Segments
************************************************************/
/* divide scope memory into segments */
ps5000MemorySegments(handle, SegmentCounts, &nMaxSamples);

/************************************************************
* Multiple Recording by Memory Segments
************************************************************/
/* Aquiring data to PS5000 memory segments */
for (currentSegments = 0; currentSegments < SegmentCounts;
currentSegments++)
{
/* start block mode */
ps5000RunBlock(handle, PreTrigger, PostTrigger,
timebase, oversample,
&timeIndisposedMs, currentSegments,
CallBackBlock, NULL);

/* Check Timeout */
while (!g_ready && !g_timeout[currentSegments])
{
g_timeout[currentSegments] = check_timeout(timeout_ms, time0);
Sleep(0);
}
}

/* Transfer data from PS5000 memory segments to PC memory */
for (currentSegments = 0; currentSegments < SegmentCounts;
currentSegments++)
{
/* register data buffer with driver */
ps5000SetDataBuffer(handle, channel, buffer_array[currentSegments],
sampleCount);

/* retrieve block-mode data with callback */
ps5000GetValues(handle, 0, &sampleCount,
downSampleRatio, downSampleRatioMode,
currentSegments, &overflow);
}

/* stop data capture */
ps5000Stop(handle);

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

Thank you for your post.

The code that you posted looks fine however I would advise that the return values are checked.

An alternative method that you might wish to consider is the use of rapid captures.

Code: Select all

ps5000SetNoOfCaptures (handle, SegmentCounts);
This would allow you to set the number of waveforms that you want to capture, then call ps5000RunBlock once. Then when the callback function indicates that all waveforms have bee taken, you have a choice how the reading he using the orginal ps5000GetValues which gets one segment at a time and allows aggregation or uses the ps5000GetValuesBulk, that allows more than one segment to be assess at a time.

Code: Select all

for (currentSegments = 0; currentSegments < SegmentCounts; 
currentSegments++) 
{ 
/* register data buffer with driver */ 
ps5000SetDataBufferBulk(handle, channel, buffer_array[currentSegments],
sampleCount,  currentSegments); 
}

ps5000GetValuesBulk
(
handle,
&sampleCount,
0,
segmentCount - 1,
overflow
)
// overflow is an array of segmentCount elements
There is a description on how to use the rapid capture in the PS5000 manual.
Regards,

Mark Spencer

akisugita
User
User
Posts: 4
Joined: Fri Oct 12, 2007 5:48 am

Thank you

Post by akisugita »

Hello markspencer

Thank you for your reply.

I'm very sorry.

The Development had stopped for as many as two years for my private reasons.
I would be able to restart it for your help.

Thank you very much, although it too slowed.

Post Reply