.NET library problem
Ältere Kommentare anzeigen
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 []
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!
Antworten (3)
zi
am 11 Jul. 2014
0 Stimmen
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
am 28 Apr. 2015
0 Stimmen
I have met the same problem. The Cypress community has no solutions.
vishwas dalal
am 17 Mär. 2022
0 Stimmen
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
Kategorien
Mehr zu Get Started with Microsoft .NET finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!