Using the McsUsbDLL library with 64-bit Matlab
3 posters
Page 1 of 1
Using the McsUsbDLL library with 64-bit Matlab
Hello MCS,
I'm trying to control my STG2004 with Matlab. To keep things as simple as possible, I'm using your example_download.m code that is supplied with the software download of MC Stimulus II. I'm running Windows 7 and Matlab 2011b (64-bit). I added the MC stim II directory and sub-directories to my path in Matlab.
When I issue the command:
if ~libisloaded('McsUsbDLL')
loadlibrary('McsUsbDLL', 'McsUsbDLL.h','alias','McsUsbDLL')
end
I get an error that reports:
McsUsbDLL.dll is not a valid Win32 application.
Does this mean that some of my settings are wrong? Is the .dll that you supplied designed to work with a 64-bit Matlab?
Thank you,
Michelle
I'm trying to control my STG2004 with Matlab. To keep things as simple as possible, I'm using your example_download.m code that is supplied with the software download of MC Stimulus II. I'm running Windows 7 and Matlab 2011b (64-bit). I added the MC stim II directory and sub-directories to my path in Matlab.
When I issue the command:
if ~libisloaded('McsUsbDLL')
loadlibrary('McsUsbDLL', 'McsUsbDLL.h','alias','McsUsbDLL')
end
I get an error that reports:
McsUsbDLL.dll is not a valid Win32 application.
Does this mean that some of my settings are wrong? Is the .dll that you supplied designed to work with a 64-bit Matlab?
Thank you,
Michelle
mkuykendal- Posts : 5
Join date : 2011-03-10
Re: Using the McsUsbDLL library with 64-bit Matlab
McsUsbDLL.dll is a 32bit Dll. So Matlab 64bit is not able to load it.
Jens
Jens
Re: Using the McsUsbDLL library with 64-bit Matlab
When will there be a 64-bit library? I'm very eager to move to 64-bits, and I'm waiting on MCS to get there! Is there anything I can do to get around this issue, or do I have to migrate back to a 32-bit system?
mkuykendal- Posts : 5
Join date : 2011-03-10
Documentation for the McsUsbDLL library
Hello Jens,
I am using the McsUsbDLL library with 32-bit Matlab now, and I have a couple of questions. The old library STG200x_lib.h used to contain the SetupTrigger function as follows:
//! Configures the trigger settings for the STG.
/*
* Note that all memory segments have its own trigger setting.
* \param device device handle of the STG to be accessed
* \param channelmap for each trigger, a bitmap of channels which belong to this trigger
* \param syncoutmap for each trigger, a bitmap of syncout which belong to this trigger
* \param digoutmap for each trigger, a bitmap of digout which belong to this trigger (online-mode only)
* \param autostart for each trigger, define weather this trigger should autostart (online-mode only)
* \param repeat for each trigger, define the number times this trigger should repeat (offline-mode only)
* \return 0 on success
*/
unsigned int USBAPI STG200x_SetupTrigger(usb_t device,
uint8 *channelmap,
uint8 *syncoutmap,
uint8 *digoutmap,
uint8 *autostart,
uint32 *repeat);
The version of this function that is now available in the McsUsbDLL.h file contains an additional parameter called "elements" and the pointers have changed:
unsigned int USBAPI STG200x_SetupTrigger(usb_t device, uint32 elements, uint32 *channelmap, uint32 *syncoutmap, uint32 *digoutmap, uint32 *autostart, uint32 *repeat);
What is this "elements" parameter? I was able to get this function to work with the old library. I would like to have the system send out four channels of sync data (for external devices) along with stimulus data (I'm using the first two stim channels) when I issue the "start" command:
unsigned int USBAPI STG200x_Start(usb_t device, int triggermap);
Right now I am using the SetupTrigger as follows (where I've guessed at the elements parameter):
calllib('McsUsbDLL', 'STG200x_SetupTrigger', DeviceID, elements??, libpointer('uint32Ptr',uint32(15)),libpointer('uint32Ptr',uint32(15)),libpointer('uint32Ptr',uint32(0)),libpointer('uint32Ptr',uint32(0)),libpointer('uint32Ptr',uint32(1)));
Are my pointers correct as well? I would like the channelmap and syncoutmap to enable all channels, so I've chosen 15 hoping that it will be interpreted as 00..01111. I do not want it to autostart and I only want one repetition.
Is there any documentation for this library? I can't find any of these functions defined anywhere, and I do not see any comments in the header file, which makes it very difficult to use the library. I would appreciate anything that you have!
Thank you for your assistance,
Michelle
I am using the McsUsbDLL library with 32-bit Matlab now, and I have a couple of questions. The old library STG200x_lib.h used to contain the SetupTrigger function as follows:
//! Configures the trigger settings for the STG.
/*
* Note that all memory segments have its own trigger setting.
* \param device device handle of the STG to be accessed
* \param channelmap for each trigger, a bitmap of channels which belong to this trigger
* \param syncoutmap for each trigger, a bitmap of syncout which belong to this trigger
* \param digoutmap for each trigger, a bitmap of digout which belong to this trigger (online-mode only)
* \param autostart for each trigger, define weather this trigger should autostart (online-mode only)
* \param repeat for each trigger, define the number times this trigger should repeat (offline-mode only)
* \return 0 on success
*/
unsigned int USBAPI STG200x_SetupTrigger(usb_t device,
uint8 *channelmap,
uint8 *syncoutmap,
uint8 *digoutmap,
uint8 *autostart,
uint32 *repeat);
The version of this function that is now available in the McsUsbDLL.h file contains an additional parameter called "elements" and the pointers have changed:
unsigned int USBAPI STG200x_SetupTrigger(usb_t device, uint32 elements, uint32 *channelmap, uint32 *syncoutmap, uint32 *digoutmap, uint32 *autostart, uint32 *repeat);
What is this "elements" parameter? I was able to get this function to work with the old library. I would like to have the system send out four channels of sync data (for external devices) along with stimulus data (I'm using the first two stim channels) when I issue the "start" command:
unsigned int USBAPI STG200x_Start(usb_t device, int triggermap);
Right now I am using the SetupTrigger as follows (where I've guessed at the elements parameter):
calllib('McsUsbDLL', 'STG200x_SetupTrigger', DeviceID, elements??, libpointer('uint32Ptr',uint32(15)),libpointer('uint32Ptr',uint32(15)),libpointer('uint32Ptr',uint32(0)),libpointer('uint32Ptr',uint32(0)),libpointer('uint32Ptr',uint32(1)));
Are my pointers correct as well? I would like the channelmap and syncoutmap to enable all channels, so I've chosen 15 hoping that it will be interpreted as 00..01111. I do not want it to autostart and I only want one repetition.
Is there any documentation for this library? I can't find any of these functions defined anywhere, and I do not see any comments in the header file, which makes it very difficult to use the library. I would appreciate anything that you have!
Thank you for your assistance,
Michelle
mkuykendal- Posts : 5
Join date : 2011-03-10
Re: Using the McsUsbDLL library with 64-bit Matlab
Dear Michelle,
the "elements" parameter is the number of triggers you are defining and corresponds to the size of the arrays you are passing in the other parameters.
In your case "elements = 1" would be the correct value, you define one trigger and have arrays of size one element for channelmap, syncoutmap, etc.
The documentation you can use is the file from the MC_Stimulus Setup:
c:\Program Files\Multi Channel Systems\MC_Stimulus II\Documentation\McsNetUsb_for_STG.chm
It is for the .NET version of our DLL, but most functions have identical parameters, only the "usb_t device" as first
parameter is needed in addition in the C version of the DLL.
The SetupTrigger is an exception this has the elements parameter in addition, since C can not determine the size of an array pointer.
Regards,
Peter
the "elements" parameter is the number of triggers you are defining and corresponds to the size of the arrays you are passing in the other parameters.
In your case "elements = 1" would be the correct value, you define one trigger and have arrays of size one element for channelmap, syncoutmap, etc.
The documentation you can use is the file from the MC_Stimulus Setup:
c:\Program Files\Multi Channel Systems\MC_Stimulus II\Documentation\McsNetUsb_for_STG.chm
It is for the .NET version of our DLL, but most functions have identical parameters, only the "usb_t device" as first
parameter is needed in addition in the C version of the DLL.
The SetupTrigger is an exception this has the elements parameter in addition, since C can not determine the size of an array pointer.
Regards,
Peter
Peter MCS- Posts : 16
Join date : 2011-10-04
Similar topics
» Multiple warnings when loading library from MATLAB
» error loading the library "McsUsbDLL" with Matlab R2009b (Mac)
» converting fp3/ldf/lrf to Matlab
» Error: STG2008 from Matlab
» McsUsbDLL.dll for 64 bit Matlab
» error loading the library "McsUsbDLL" with Matlab R2009b (Mac)
» converting fp3/ldf/lrf to Matlab
» Error: STG2008 from Matlab
» McsUsbDLL.dll for 64 bit Matlab
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum