.NET library problem
显示 更早的评论
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!
回答(3 个)
zi
2014-7-11
0 个投票
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
2015-4-28
0 个投票
I have met the same problem. The Cypress community has no solutions.
vishwas dalal
2022-3-17
0 个投票
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
类别
在 帮助中心 和 File Exchange 中查找有关 Get Started with Microsoft .NET 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!