How to use the 64bit wrapper file

Post your MATLAB discussions here
Post Reply
dunxm
Newbie
Posts: 0
Joined: Thu Jun 26, 2014 10:07 am

How to use the 64bit wrapper file

Post by dunxm »

I'm trying to use a PicoScope 2205A from Matlab 2013b (64bit) in fast streaming mode. I've determined that I need to use the functions in ps2000WrapMFile to get around the issue of needing to supply a callback. However I don't know what these functions do. There is mention in these forums of looping around PollFastStreaming and FastStreamingReady but nothing to say what the loop should terminate or continue on.

Is there any documentation for the functions in ps2000WrapMFile or a working example that I can see?

Hitesh

Re: How to use the 64bit wrapper file

Post by Hitesh »

Hi dunxm,

The Wrapper dll was updated in the last couple of releases of the SDK - please ensure that you have version 10.5.0.32 of the PS2000 SDK which can be downloaded from http://www.picotech.com/software.html.

The changes were made to ensure that data is copied to an application buffer specified for a channel inside the callback function to avoid lost data issues that were previously encountered.

There is a source code file (ps2000Wrap.c) in the Wrapper/ps2000Wrap directory in the SDK which provides a description of each function - you can open this in a text editor or MATLAB's own editor.

Below is the recommended sequence of steps for Fast Streaming:

1. Open the oscilloscope using ps2000_open_unit().
2. Set the channel count on the device using the wrapper’s setChannelCountI() function.
3. Select channel ranges and AC/DC switches using ps2000_set_channel().
4. Inform the wrapper of the channels that are enabled using setEnabledChannels().
5. Set the trigger using ps2000_set_trigger().
6. Set the application buffers in the wrapper for data to be copied into during fast streaming data collection using SetBuffer() or SetAggregateBuffer() for non-aggregated or aggregated data collection respectively.
7. Start the oscilloscope running using ps2000_run_streaming_ns().
8. Call the wrapper’s PollFastStreaming() and FastStreamingReady() functions until the wrapper indicates that data is available.
9. Call the wrapper’s GetFastStreamingDetails() function to obtain information on the data collected – number of samples, trigger and overflow, auto stop and to indicate if the application buffer is full.
10. Display or process the data.
11. If required, check for overview buffer overruns by calling ps2000_overview_buffer_status().
12. Repeat steps 8 to 11 as necessary or until auto_stop is TRUE.
13. Stop fast streaming using ps2000_stop().
14. Retrieve any part of the data at any time scale by calling ps2000_get_streaming_values().
15. If you require raw data, retrieve it by calling ps2000_get_streaming_values_no_aggregation().
16. Repeat steps 14 to 15 as necessary.
17. Call the wrapper's clearFastStreamingParameters function, particularly if you intend to start another data collection run.
18. Close the oscilloscope by calling ps2000_close_unit().

I presume you are writing your own script as opposed to using the Instrument Driver package? Although some investigation has been carried into collecting Fast Streaming data using MATLAB here, you may find that due to the overhead, there may be some lost data if you are collecting raw data values - I suggest using a 1Hz sine wave as a test signal and a large value for the overview buffer size. You may also wish to experiment using aggregation.

The ps2000_get_streaming_values_no_aggregation() will be useful if you require the raw data values.

I hope this helps.
Last edited by Hitesh on Thu Jun 26, 2014 2:41 pm, edited 2 times in total.
Reason: Update to sequence of steps.

Post Reply