how to load dll file ? "The specified module could not be found." i have refered lot

14 views (last 30 days)
hai i am using a USB to SPI converter IC(MCP2210) from Micrpchip...they have provided .dll file,I need to load it in to Matlab for working of that chip.
i have tried very hard.....below i have shown editor work i did and message i got...
>> cd('c:\work')
>> hfile = fullfile(matlabroot,'extern','include','matrix.h');
>> loadlibrary('MCP2210DLL',hfile,'mfilename','mxproto')
Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(...) > In loadlibrary at 344 Error using loadlibrary (line 419) There was an error loading the library "MCP2210DLL" The specified module could not be found.
Caused by: Error using loaddefinedlibrary The specified module could not be found.
i have even tried dependance walker and added the missing file, it dont work. and i have added that .dll file download link below. http://ww1.microchip.com/downloads/en/DeviceDoc/MCP2210_DLL_v1.1.1.zip i need help plz

Accepted Answer

Friedrich
Friedrich on 4 Jan 2013
Edited: Friedrich on 4 Jan 2013
Hi Ikram,
the main raison why loadlibrary doesn't work is that your DLL is a .NET DLL. So please use NET.addAssembly. Once you use this, its easy going. Please note that you need Windows for this and VERY important: use a 32bit MATLAB or otherwise the DLL can't be loaded.
>> asb = NET.addAssembly(fullfile(pwd,'MCP2210DLL-M.dll'))
asb =
NET.Assembly handle
Package: NET
Properties for class NET.Assembly:
AssemblyHandle
Classes
Structures
Enums
GenericTypes
Interfaces
Delegates
>> asb.Classes
ans =
'MCP2210.DevFunctions_M'
'MCP2210.DevSettings_M'
'MCP2210.DevSpecial_M'
'MCP2210.DllConstants'
'MCP2210.DevIO'
>> MCP2210.DevIO(hex2dec('04D8'),hex2dec('00DE'))
ans =
MCP2210.DevIO handle
Package: MCP2210
Properties:
Functions: [1x1 MCP2210.DevFunctions_M]
Settings: [1x1 MCP2210.DevSettings_M]
Special: [1x1 MCP2210.DevSpecial_M]
Methods, Events, Superclasses
>> ans.Settings.GetConnectionStatus
ans =
0
Good Luck :)
  2 Comments
ikram khan
ikram khan on 20 Apr 2013
i have loaded this .dll file, now i can able to control GPIO pins and configure the Bit rate etc..using this dll functions.
but in final stage after all the configuration, i need to receive the data from MCP2210 chip connected to a ADC. for this, dll have a function TxferSpiData
Name: TxferSpiData Purpose: Transfer the specified SPI data
Parameters:
Inputs: dataTx (array<Byte>^) - Array of SPI data to send to device. This array should be at least the same size as numBytes or larger.
Outputs: dataRx (array<Byte>^) – Array that contains SPI data received. This array should be at least the same size as numBytes or larger. Returns: int - Return value: negative = error 0 = success
i have did the below, when i call the function,no error, and return 0 for success. variable c should have ADC data of 27 bytes loaded into it. but it is not loading.
b=uint8(zeros(1,27));
c=uint8(zeros(1,27));
khan.Functions.TxferSpiData(b,c);
Bolivar
Bolivar on 31 Oct 2013
Edited: Bolivar on 31 Oct 2013
Hi Friedrich,
I also face the same issue when adding NetDocDelegate.dll into MATLAB with fullpath=fullfile('C:','C:\Windows','NetDocDelegate.dll') NET.addAssembly(fullpath) command. Matlab generate an error going like this : the system cannot find the specified file. I have searched my drive for NetDocDelegate.dll, no presence of such a file!!! what should i do? I am actually using a 64 bits version of MATLAB(2013Ra)Student version.
may someone help me? thanks bolivar

Sign in to comment.

More Answers (3)

Kaustubha Govind
Kaustubha Govind on 3 Jan 2013
  2 Comments
ikram khan
ikram khan on 3 Jan 2013
Edited: ikram khan on 3 Jan 2013
Thank u for the Replay
i have tried dependency walker, no dll is missing and it showing two errors in txt file in last line.....i have attached that text file generated by dependancy walker and the screen image of it.....since there is no option to upload in this page....so i have uploaded the to following URL.....(this is in google drive,it can be oped just by cliking it or copy and use)
https://docs.google.com/open?id=0Bws2MsjT5CWcWnRJbzNSRlV0MDQ or
www.cancerhelpline.in/math replay.rar (from my domine space)
(this url contain error report of Dependancy walker and screen image)
the dll is in this link..
i have also added the dll file url from Microchip website....mostely i tried every thing in web(installed all complier,checked dependancy ect..)t
i am working on my BE final year project. it is very importent for me plz help.
if can plz generate and give me protofile,to use the dll.... ikramkhan11692@gmail.com
Kaustubha Govind
Kaustubha Govind on 4 Jan 2013
Ikram: Sorry, this forum is really for voluntary participation of MATLAB users, so most of us don't have a lot of time to spend on questions posted here - it will help if you can post specific questions that those of us with expertise can contribute best to. I briefly went through your log, and at the bottom, I see:
Error: Modules with different CPU types were found
This might be key - perhaps you have mixed 32-bit and 64-bit DLLs? Your DLL and its dependencies need to be the same type as your MATLAB application.

Sign in to comment.


ikram khan
ikram khan on 5 Jan 2013
Thank u very much Kaustubha Govind and Friedrich..its working in 32bit matlab

Jesus Meza Serrano
Jesus Meza Serrano on 13 Feb 2020
Good night to all:
Why when I try?: >ans.Settings.GetConnectionStatus
ans =
0
My anwer: ans = 1.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!