.NET library problem
3 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(3 个)
zi
2014-7-11
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
0 个评论
vishwas dalal
2022-3-17
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!