.NET library problem
Mostrar comentarios más antiguos
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!
Respuestas (3)
zi
el 11 de Jul. de 2014
0 votos
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
el 28 de Abr. de 2015
0 votos
I have met the same problem. The Cypress community has no solutions.
vishwas dalal
el 17 de Mzo. de 2022
0 votos
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
Categorías
Más información sobre Get Started with Microsoft .NET en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!