Picoscope executable

Post your MATLAB discussions here
Post Reply
Renaat
Newbie
Posts: 0
Joined: Mon Dec 03, 2012 10:28 am

Picoscope executable

Post by Renaat »

Hello,

Below i have some code to read my signal into matlab.
After this i do some operations. This works all but now i want to make an executable so i can use it on a pc without maltab. When i make the executable i always get a problem. Always at loadlibrary. The error is can't find lcc.exe.
i already installed MRC (Matlab runtime compiler) but still the same problem.
After some search work i found that i have to make a prototype file or something like that.
Got somebody experience with that with the picoscope and can help me further ?

Thx in advance

Renaat

Code: Select all

loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
if ~libisloaded('PS5000')
error('library PS5000.dll or PS5000.h not found') %check if the library is loaded
end

pBufferChA = libpointer('int16Ptr', zeros(4000000, 1));
[methodinfo,structs,enuminfo] = PS5000MFile;                        % Data and method structure for the ps5000 api.

unithandle = 0;                                                     % Handle to the opened unit.
maxsamples = 4000000;                                               % Aantal samples = 1000000    
noOfPreTriggerSamples = 0;                                          % Aantal samples er genomen moeten worden voor de trigger
noOfPostTriggerSamples = 4000000;                                   % Aantal samples er dienen genomen te worden na een trigger
timebase = 627;                                                     % Om het sampleinterval in te stellen 627
oversample = 1;
timeIndisposedMs = [];                                              % Callback not used
segmentIndex = 0;                                                   % Leave set to 0 unless the data is being captured in a specific segment on the device.
lpReady = [];                                                       % Callback not used
pParameter = [];                                                    % Callback not used
overflow = [];                                                      % Callback not used
channelA = enuminfo.enPS5000Channel.PS5000_CHANNEL_A;               % Instellen voor het gebruik van channel A
%range = enuminfo.enPS5000Range.PS5000_20V;                         % Instellen van onze spanningsrange
range = Voltagerange;
downSampleRatioMode = enuminfo.enRatioMode.RATIO_MODE_NONE;
true1 = enuminfo.enTriggerState.CONDITION_TRUE;
[status_open,unithandle] = calllib('PS5000','ps5000OpenUnit',unithandle);           % Openen van onze picoscope

status_ps5000SetChannel = calllib('PS5000','ps5000SetChannel',unithandle,channelA,true1,true1,range);         % Instellen van onze channel

status_ps5000GetTimebase = calllib('PS5000','ps5000GetTimebase',unithandle,timebase,4000000,0,oversample,maxsamples,0);         % instellen van de tijdsbasis

status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle, noOfPreTriggerSamples,...
    noOfPostTriggerSamples, timebase, oversample, timeIndisposedMs, segmentIndex, lpReady, pParameter);         % Meting starten van onze picoscope

ready = 0;

% Poll the driver until it has captured some data
while(ready == 0)
[status_read, ready] = calllib('PS5000', 'ps5000IsReady', unithandle, ready);
pause(0.1);
end

status_ps5000SetDataBuffer = calllib('PS5000','ps5000SetDataBuffer',unithandle,channelA,pBufferChA,4000000);        % Waarden in pBufferCha opslaan

status_ps5000GetValues = calllib('PS5000','ps5000GetValues',unithandle,0,4000000,0,downSampleRatioMode,0,overflow);         % Ophalen van onze waarden uit de databuffer

bufferChA = get(pBufferChA, 'Value');

status_close = calllib('PS5000','ps5000CloseUnit',unithandle);

Hitesh

Re: Picoscope executable

Post by Hitesh »

Hi Renaat,

You would have generated your prototype file when executing the line:

Code: Select all

loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
I've not compiled an executable before from MATLAB but you might want to change the line to:

Code: Select all

loadlibrary 'PS5000.dll' 'PS5000MFile';
Hope this helps.

Post Reply