Test and Measurement Forum

Error calling ps3000 functions in MATLAB

Post your MATLAB discussions here

Error calling ps3000 functions in MATLAB

Postby Hud » Mon Dec 08, 2014 9:41 am

Hi,
I've got a problem using a PicoScope 3423 with Matlab. I use ps3000.dll with ps3000.h of the current SDK. My objective is to use the compatible streaming mode. So i followed the instructions:

ps3000_open_unit() -> Device is opened ( I can hear it and I can't use it with PicoScope Software anymore )
But already here starts the problem: The function returns a voidPtr as device handle. So I cant prove if a oscilloscope is found. But I can use this voidPtr as handle for my other functions. ( So I can close it for example)

I can use all functions of the instructions, I just can't read the Returns because I just get voidPtrs. But I don't get data while using ps3000_get_values and as long as I dont know if my Channel is set correctly or if streaming started running I don't know where my configuration issue could be. Is there a possibility to convert those voidPtr to a number or sth like this? (I tried "get( ... ,'value')" already) Please help me to solve this problem.

Code: Select all
if not(libisloaded('ps3000'))
    loadlibrary('ps3000','ps3000.h')
end

unitHandleTemp = 0

unitHandleTemp = calllib('ps3000', 'ps3000_open_unit')

Status = calllib('ps3000','ps3000_close_unit', unitHandleTemp)

(After running this code, my Status and unitHandleTemp looks like that: Status = libpointer)

Regards Michael
Hud
Newbie
 
Posts: 0
Joined: Mon Dec 08, 2014 8:50 am

Re: Error calling ps3000 functions in MATLAB

Postby Hitesh » Mon Dec 08, 2014 11:28 am

Hi Michael,

It's possible the data types have not been processed correctly when loading the library.

Can you post a screenshot of what is displayed if you call

Code: Select all
libfunctionsview('ps3000');

after calling the loadlibrary function.

Thanks,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Error calling ps3000 functions in MATLAB

Postby Hud » Mon Dec 08, 2014 11:38 am

Hi Hitesh,

screenshot in attachment.

Regards
Michael
Attachments
libfunctionsview.png
Hud
Newbie
 
Posts: 0
Joined: Mon Dec 08, 2014 8:50 am

Re: Error calling ps3000 functions in MATLAB

Postby Hitesh » Mon Dec 08, 2014 12:15 pm

Hi Michael,

You've probably got the stdint.h header file missing from your PC or not on the MATLAB path so it cannot resolve the data types in the header file.

I've generated a prototype file using a 32-bit version of MATLAB which you can use in place of the ps3000.h header file:

Code: Select all
loadlibrary('ps3000.dll', @ps3000MFile);

You can access the enumerations and structures contained in the file as well:

Code: Select all
[methodinfo,structs,enuminfo,ThunkLibName]=ps3000MFile

Hope this helps.
Attachments
ps3000MFile.m
Prototype file
(13.7 KiB) Downloaded 41 times
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Error calling ps3000 functions in MATLAB

Postby Hud » Mon Dec 08, 2014 2:20 pm

Thank you very much! Now it works fine.

Regards
Michael
Hud
Newbie
 
Posts: 0
Joined: Mon Dec 08, 2014 8:50 am

Re: Error calling ps3000 functions in MATLAB

Postby Hitesh » Mon Dec 08, 2014 2:33 pm

Great! :D

Thanks for letting us know.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to MATLAB

Who is online

Users browsing this forum: No registered users and 1 guest