multi-frame sequence

Multi-frame sequence, a forum discussion on Cleverscope Mixed Signal USB Oscilloscopes. Join us for more discussions on Multi-frame sequence on our Questions forum.

Back to Forum Index : Back to Questions   RSS
jansova

6 May 2009
Posts:

Hi,

I need to read not only one frame (with max 2000 samples) but the whole memory (4MS). I'm using C# and my application is based on Cscope Simple Scope application (I downloaded this app. on cleverscope.com). I wrote function with this code:

public static UInt16 scope_read_frames(float[] a_waveform, float[] b_waveform, ref UInt32 num_samples)
{
UInt32 i;

CAU_status = call_cscope_control_driver(8);
CAU_status = call_cscope_control_driver(3);

Console.WriteLine(CAU_status.ToString());

for (i = 0; i < samples_returned; i++)
{
a_waveform = a_samples;
}

for (i = 0; i < samples_returned; i++)
{
b_waveform = b_samples;
}

num_samples = samples_returned;
return CAU_status;
}


But in every time I get no more than 2000 samples. Where is my error? Function call_cscope_control_driver is from Clever scope simple application:

static UInt16 call_cscope_control_driver(UInt16 command)
{
Cscope_driver.CscopeControlDriver(acquisition_unit,command, acquire.StartTime, acquire.StopTime, samples_required, frame_number, ref acquire, ref got_samples,
ref t0, ref dt, ref samples_returned, ref frames_returned, a_samples, max_samples * sizeof(double), b_samples, max_samples * sizeof(double),
dig_samples, max_samples * sizeof(UInt16), ref CAU_status, ref scope_error);

return CAU_status;
}

Thank you very much :-).

Honza Sova
bartschroder

7 May 2009
Posts: 478

Hello Honza,
You need to tell the cleverscope how many samples you want to get. Check out 'Cscope Control Driver DLL description.pdf' to find the detail.

I think there are a few questions here. I shall attempt to explain!

1. Single large Capture and transfer
---------------------------------------
You have two frames setup (the 'NumBuffers' in the Acquire variable = 2), and you are capturing one frame at a time ('NumSeqFrames = 1). With 4M of memory, each frame will be 2M samples long. One will be used waiting for a trigger, the other can be read. Your capture period will need to be larger than 20msecs, or the number of samples will be reduced (we can only capture at 10ns intervals maximum).

Here is the sequence:
1. Setup the acquire variable. Lets say it's a triggered acquisition. Set Aqcuire mode to Single (0). Set Acquisition Mode to sampled (0) as we are getting all samples. Set Start Time (eg -0.01 secs) and Stop Time (eg +0.01 sec). Set Trigger etc.
2. Issue an acquire command. Set the ReplayStartTime to -0.01 and the ReplayStopTime to +0.01, set the SamplesInReplay to 2M. Make sure that you have changed the constant max_samples to 2M.
3. Call 'Wait for samples' until GotSamples is true.
4. Get the samples as in your code above. Because you asked for 2M samples, that's what you will get.

The Acquire command automatically returns the samples you asked for. I sense some confusion here, and it is because Cleverscope captures one set of samples, but can replay multiple different views of the sample set (that's how the scope, tracker and spectrum graphs work). When replaying a smaller view, the acquisition unit decimates the sample set to make it fit into the number of samples you have requested.

So after having done an acquire, you can follow this up with a replay, with different values for ReplayStartTime, ReplayStopTime and SamplesInReplay, and only the portion of the signal you requested will be returned.

2. Multiple consecutive triggered frames.
-----------------------------------------------
You want to capture multiple consecutive frames, and transfer them all in one go. For example you want to capture the next 300 triggers, which might be a digital message and associated analog changes (we have an example of something like this in our examples page).

To do this you will need to set up the trigger you want, and then the following values -
'NumBuffers' needs to be 1 more than the number of frames to capture, eg 301.
'NumSeqFrames' is the number of frames to capture in a sequence = 300.
With 4M of memory, each frame will be 13,289 samples. The acquisition unit will automatically choose a sample rate that allows it to meet your start and stop times.

Set up the start and stop times. For example, you message is 240us long, you want Start = -10u, and stop = 230u. Because we have only 13,289 samples available, the sampling interval will be 20ns.

Here is the sequence:
1. Setup the acquire variable. It's a triggered acquisition. Set Acquire mode to Single (0). The acquisition unit will re-run the single trigger 300 times. Set Acquisition Mode to sampled (0) as we are getting all samples. Set Start Time (eg -10 usecs) and Stop Time (eg +230 usec). Set Trigger, NumBuffers, Numseqframes etc.
2. Issue an acquire command. Set the ReplayStartTime to -10u and the ReplayStopTime to +240u, set the SamplesInReplay to whatever you want - eg 13,000. Make sure that you have changed the constant max_samples to 2M, for later.
3. Call 'Wait for samples' until GotSamples is true. This will return the most recent frame, decimated to 13,000 samples.
4. Call 'Get Frames', which will initiate a transfer of all the frames in one go.
5. Call 'Wait for Samples' until GotSamples is true. All the samples have been returned.
The value NumSamples are the number of samples per frame, NumFrames is the number of frames returned. All the samples will be returned as one array, one frame after the next, for NumFrames times. When you read the frames, you can either read (NumSamples * NumFrames) samples all into one array, or you can read NumSamples samples into NumFrames arrays. It's up to you.

3. Random sporadic triggers saved into multiple frames
-------------------------------------------------------------
You have set the number of frames to be more than 2 (say 120). You have been capturing frames one at a time (say 67 of them). Now you want to transfer them all back to the PC. You need to do this a frame at a time using the Replay command. You do this by setting the start/stop times and number of samples you want returned, and you also specify the frame number (0..66), and then call the replay command. Use WaitforSamples and check GotSamples for each replay. Do this 67 times.

I hope this helps.
jansova

7 May 2009
Posts:

Thank you very much! I will try it today.

Honza
Back to Forum Index : Back to Questions   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.

×

Your shopping cart is empty.