.NET library problem

11 views (last 30 days)
A
A on 12 Sep 2013
Answered: vishwas dalal on 17 Mar 2022
Hello all.
I am trying to add the Cypress USB library CyUSB.dll to Matlab and use a script to:
1. connect to the usb device 2. get data 3. live plot and save to text file.
Here is what I have so far:
%%Load .NET Assembly
try
CyUSBdll = NET.addAssembly('C:\Users\Aobo-Locata\Desktop\adfa stuff\CyUSB.dll');
catch error
error.message
if(isa(error,'NET.NetException'))
e.ExceptionObject
else
disp('CyUSB.dll already loaded');
return;
end
end
%%USB Device Select
% Create a list of USB devices
usbDevices = CyUSB.USBDeviceList(CyUSB.CyConst.DEVICES_CYUSB);
% Number of devices
num_Devices = usbDevices.Count
%myUSBDevice = usbDevices.Item(VID,PID)
%myUSBDevice = usbDevices.Item(0)
So num_Devices returned 1, showing that it indeed found 1 device.
However, using any of the Item methods above crashes Matlab instantly. Interesting if I feed in bogus parameters (like Item(2)), myUSBDevice returns as []
This is the programmer guide... http://www.cypress.com/?docID=45233
I thought it might be because usbDevices is a list of CyUSB.USBDevice which is an abstract class, however I tried to cast it and it didn't work either:
%myUSBDevice = CyUSB.CyUSBDevice(usbDevices.Item(0))
It complained about how it can't find CyUSBDevice type.. grrr.
Could someone please have a look at the CyUSB.NET library and help me out? I have spent days on this already, totally out of ideas. Thanks so much!

Answers (3)

zi
zi on 11 Jul 2014
Hi,
I am trying to use Matlab to access CY7C68013, but haven't got any idea yet...I think you have done similar task...could you share something with me...?
Thanks

Junbin Zhang
Junbin Zhang on 28 Apr 2015
I have met the same problem. The Cypress community has no solutions.

vishwas dalal
vishwas dalal on 17 Mar 2022
Hello,
Just wondering if you have this code working now? I am able to get the device into matlb, but do not know what to do to stream data into matlab.
regards

Community Treasure Hunt

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

Start Hunting!