The Software Development Kits (SDKs) for PicoScope devices contain wrapper dynamic link library (DLL) files in a subdirectory of the Wrapper directory. The wrapper functions provided by the wrapper DLLs are for use with programming languages such as MathWorks MATLAB®, National Instruments LabVIEW and Microsoft Excel VBA that do not support features of the C programming language such as callback functions.

As of SDK release 10.5.0.32, the wrapper DLLs (SDK release 10.6.10 for the ps5000Wrap.dll for the now obsolete PicoScope 5203 and 5204) have been updated to ensure data is copied to application buffers inside the streaming callback defined in the respective Programmer’s Guides, and 64-bit versions have been made available in an x64 subdirectory in the Wrapper directory.

The source code contained in the Wrapper projects contains a description of the functions and the input and output parameters.

This post explains the sequence of calls required to capture data in streaming mode using the respective wrapper API functions.

For the PicoScope 2000 Series and PicoScope 3000 Series using the API functions provided by the ps2000.dll and ps3000.dll libraries respectively, the streaming callback mechanism operates differently. We recommend using the approaches outlined below which are based on the steps outlined in the respective Programmer’s Guides but with a few changes.

PicoScope 2000:

Applies to: PicoScope 2203, 2204, 2204A, 2205 and 2205A

Note that the size of the data buffers specified for step 6 will need to be the maximum number of samples to be collected.

This is the general procedure for reading and displaying data in fast streaming mode:

1. Open the oscilloscope using ps2000_open_unit().

2. Set the channel count on the device using the wrapper’s setChannelCount() function.

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. Inform the wrapper of the size of the application and overview buffers using setCollectionInfo() (available in versions of ps2000Wrap.dll after 1.0.1.23).

8. Start the oscilloscope running using ps2000_run_streaming_ns().

9. Call the wrapper’s PollFastStreaming() and FastStreamingReady() functions until the wrapper indicates that data is available.

10. 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.

4. Inform the wrapper of the channels that are enabled using setEnabledChannels().

5. Set the trigger using ps3000_set_trigger().

6. Set the application buffers in the wrapper for data to be copied into during fast streaming data collection using SetDataBuffer() or SetDataBuffers() for non-aggregated or aggregated data collection respectively.

7. Start the oscilloscope running using ps3000_run_streaming_ns().

8. Call the wrapper’s GetStreamingLatestValues() and IsReady() functions until the wrapper indicates that data is available.

9. Call the wrapper’s AvailableData() function to obtain information on the data collected – number of samples, trigger and overflow.

14. Retrieve any part of the data at any time scale by calling ps3000_get_streaming_values().

15. If you require raw data, retrieve it by calling ps3000_get_streaming_values_no_aggregation().

16. Repeat steps 14 to 15 as necessary.

17. Close the oscilloscope by calling ps3000_close_unit().

Other PicoScope devices:

For PicoScope using the API functions provided by the DLLs and their respective wrapper files listed below, please use the following general sequence of steps which are based on the Programmer’s Guides:

These wrapper dlls will copy data from the driver buffer specified to a temporary application buffer of the same size when they are registered with the wrapper and the channel is specified as being enabled. You should process the data in the temporary application buffer accordingly e.g. copy the data into a large array.

Note: replace ‘XXXX’ where used in a function call with the series name used by the DLL e.g. ‘4000’ or ‘5000a’.

Steps:

1. Open the oscilloscope using psXXXXOpenUnit().1a. Inform the wrapper of the number of channels on the device by calling setChannelCount().1b. [MSOs only] Inform the wrapper of the number of digital ports on the device by calling setDigitalPortCount() (Note: this is not required for the ps2000aWrap dll).

2. Select channels, ranges and AC/DC coupling using psXXXXSetChannel().2a. Inform the wrapper which channels have been enabled by calling setEnabledChannels().2b. [MSOs only] Inform the wrapper which digital ports have been enabled by calling setEnabledDigitalPorts().

3. [MSOs only] Set the digital port using psXXXXaSetDigitalPort().

4. Use the appropriate trigger setup functions. For programming languages that do not support structures, use the wrapper's advanced trigger setup functions.

5. [MSOs only] Use the trigger setup function psXXXXaSetTriggerDigitalPortProperties() to set up the digital trigger if required.

8. Loop and call GetStreamingLatestValues() and IsReady() to get data and flag when the wrapper is ready for data to be retrieved.8a. Call the wrapper’s AvailableData() function to obtain information on the number of samples collected and the start index in the buffer.8b. Call the wrapper’s IsTriggerReady() function for information on whether a trigger has occurred and the trigger index relative to the start index in the buffer.

9. Process data returned to your application's function.

10. Call AutoStopped() if the autoStop parameter has been set to TRUE in the call to psXXXXRunStreaming()

12. Call psXXXXStop(), even if the autoStop parameter was set to TRUE.

13. To disconnect a device, call psXXXXCloseUnit().

Note that the PicoScope 3000 Series devices using the ‘A’ API provided by the ps3000a.dll use a wrapper DLL that can support up to 4 devices – please refer to the Wrapper functions section in the PicoScope 3000 Series (A API) PC Oscilloscopes and MSOs Programmer’s Guide for further information.

Sorry for the long post but hopefully this will help to explain how the wrapper functions are used for streaming data capture.

Last edited by Hitesh on Fri Feb 17, 2017 10:21 am, edited 5 times in total.
Reason:Updated for 5203/4 and new PicoScope 2000 Series devices

Where to find a "Programmer's guide" including a description of Wrapper API functions (effect, arguments, returns). I use "Programmer's guide" ps2000.pg.en.pdf for PS2000 API functions, but I don't see the equivalent for Wrapper API functions.