Welcome to our user forum (read only mode).
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Using the McsUsbDLL library with 64-bit Matlab

3 posters

Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Using the McsUsbDLL library with 64-bit Matlab

Post  mkuykendal Mon Mar 12, 2012 8:42 pm

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

mkuykendal

Posts : 5
Join date : 2011-03-10

Back to top Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Re: Using the McsUsbDLL library with 64-bit Matlab

Post  Jens Tue Mar 13, 2012 11:19 am

McsUsbDLL.dll is a 32bit Dll. So Matlab 64bit is not able to load it.

Jens

Jens

Posts : 55
Join date : 2009-03-06
Location : Multi Channel Systems

http://www.multichannelsystems.com

Back to top Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Re: Using the McsUsbDLL library with 64-bit Matlab

Post  mkuykendal Tue Mar 13, 2012 6:55 pm

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

Back to top Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Documentation for the McsUsbDLL library

Post  mkuykendal Tue Mar 13, 2012 11:17 pm

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


mkuykendal

Posts : 5
Join date : 2011-03-10

Back to top Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Re: Using the McsUsbDLL library with 64-bit Matlab

Post  Peter MCS Wed Mar 14, 2012 1:05 pm

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

Peter MCS

Posts : 16
Join date : 2011-10-04

Back to top Go down

Using the McsUsbDLL library with 64-bit Matlab Empty Re: Using the McsUsbDLL library with 64-bit Matlab

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum