Clear Filters
Clear Filters

Need help for Instrument Control Toolbox with PicoScope 5000a

3 views (last 30 days)
I am acquring data in Matlab using Picoscope and Matlab instrument driver master for PicsoScope 5243D. I want all the data to be acquired in floating point rather then being in integer format. I have tried several attempt and now require help with this that How can i acquire a raw data in floating point using Instrument control Toolbox for PicoScope?
The code for Data buffer, which include driver buffer and application buffer:
%% Set data buffers
% Data buffers for channels A and B - buffers should be set with the driver,
% and these *MUST* be passed with application buffers to the wrapper driver.
% This will ensure that data is correctly copied from the driver buffers
% for later processing.
overviewBufferSize = 100000; % Size of the buffer to collect data from buffer.
segmentIndex = 0;
ratioMode = ps5000aEnuminfo.enPS5000ARatioMode.PS5000A_RATIO_MODE_NONE;
% Buffers to be passed to the driver
pDriverBufferChA = libpointer('int16Ptr', zeros(overviewBufferSize, 1, 'int16'));
status.setDataBufferChA = invoke(ps5000aDeviceObj, 'ps5000aSetDataBuffer', ...
channelA, pDriverBufferChA, overviewBufferSize, segmentIndex, ratioMode);
% Application Buffers - these are for copying from the driver into.
pAppBufferChA = libpointer('int16Ptr', zeros(overviewBufferSize, 1, 'int16'));
% Streaming properties and functions are located in the Instrument Driver's
% Streaming group.
streamingGroupObj = get(ps5000aDeviceObj, 'Streaming');
streamingGroupObj = streamingGroupObj(1);
status.setAppDriverBuffersA = invoke(streamingGroupObj, 'setAppAndDriverBuffers', channelA, ...
pAppBufferChA, pDriverBufferChA, overviewBufferSize);

Answers (1)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU on 24 Jan 2024
Hi hsnal,
To acquire data in floating-point format from your “PicoScope 5243D” using MATLAB's Instrument Control Toolbox, you should create a “libpointer” object with a data type of “singlePtr”. This pointer will be used to store single-precision floating-point values.
pAppBufferChA = libpointer('singlePtr', zeros(overviewBufferSize, 1, 'single'));
% singlePtr is the data type for the pointer, indicating single-precision floating point.
%zeros (overviewBufferSize, 1, 'single') initializes a zero-filled array of the specified size (overviewBufferSize) with single-precision floating-point values.
%pAppBufferChA is the name given to the libpointer object, which will be used to store the floating-point data from the PicoScope.
Use this “libpointer” when setting the data buffer in your MATLAB code to ensure that the “PicoScope's” data is stored as floating-point values.
You can refer to the following documentation to know more about the different data types: https://www.mathworks.com/help/matlab/matlab_external/passing-arguments-to-shared-library-functions.html.
I hope this helps!

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!