Thread Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Heather

Date: 24 Jun, 2009 18:30:03

Message: 1 of 10

Hi,

This might be a somewhat specific question-- but if anyone has any experience with using the DAQ toolbox with an ADLink DAQ card, any feedback/experience would be appreciated.

We have an ADLink PCI-7300A Rev B high-speed digital I/O card. ADLink has released a MATLAB library + adaptor that allows you to use ADLink DAQ cards with MATLAB's DAQ toolbox.

We have installed this library, according to the user manual supplied by ADLink. When we check, in MATLAB, to see that the card is recognized, we get the following,

>> hwinfo = daqhwinfo

hwinfo =

          ToolboxName: 'Data Acquisition Toolbox'
       ToolboxVersion: '2.12 (R2008a)'
        MATLABVersion: '7.6 (R2008a)'
    InstalledAdaptors: {5x1 cell}

>> adqpters =hwinfo.InstalledAdaptors

adqpters =

    'mcc'
    'mwadlink'
    'nidaq'
    'parallel'
    'winsound'

>> ADLINK_INFO = daqhwinfo('mwadlink')

ADLINK_INFO =

           AdaptorDllName: 'C:\ADLINK\DAQ-MTLB\DLL\mwADLINK.dll'
        AdaptorDllVersion: '1, 2, 0, 0'
              AdaptorName: 'mwadlink'
               BoardNames: {'PCI-7300'}
        InstalledBoardIds: {'0'}
    ObjectConstructorName: {'' '' ''}


Clearly, MATLAB recognizes the ADLink adapter. However, it returns an empty array of object constructors...

So when we attempt to create a digitalio object (using MATLAB's DAQ toolbox), MATLAB experiences a Segmentation Violation.

...Does anyone have any idea how to resolve this? I'm not finding anyone with similar issues on internet message boards.

(PS, this occurs across computers, and across versions of MATLAB...)

SYSTEM INFO:
==================================================
MATLAB Version 7.6.0.324 (R2008a)
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
Java VM Version: Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.6 (R2008a)
Data Acquisition Toolbox Version 2.12 (R2008a)

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Heather

Date: 22 Jul, 2009 21:37:01

Message: 2 of 10

This is just a follow up to this issue... After a month of hassling ADLink for some answers (without any reply on ADLink's end), I received the following email about using the DAQ Toolbox with our ADLink card:

"After reviewing your question and doing some research, unfortunately, MATLAB's ToolBox only supports software polling mode on the auxiliary DIO ports. You can not use MATLAB ToolBox to perform high-speed DIO on the 32 ports on port A and port B."

So for anyone interested, you can't use an ADLink 7300A to output data on any ports but the auxillary ports (useless when you need 32-channels)

Hope that helps anyone who has/had a similar problem :-)





"Heather " <heather.c.miller@gmail.com> wrote in message <h1trbb$8o8$1@fred.mathworks.com>...
> Hi,
>
> This might be a somewhat specific question-- but if anyone has any experience with using the DAQ toolbox with an ADLink DAQ card, any feedback/experience would be appreciated.
>
> We have an ADLink PCI-7300A Rev B high-speed digital I/O card. ADLink has released a MATLAB library + adaptor that allows you to use ADLink DAQ cards with MATLAB's DAQ toolbox.
>
> We have installed this library, according to the user manual supplied by ADLink. When we check, in MATLAB, to see that the card is recognized, we get the following,
>
> >> hwinfo = daqhwinfo
>
> hwinfo =
>
> ToolboxName: 'Data Acquisition Toolbox'
> ToolboxVersion: '2.12 (R2008a)'
> MATLABVersion: '7.6 (R2008a)'
> InstalledAdaptors: {5x1 cell}
>
> >> adqpters =hwinfo.InstalledAdaptors
>
> adqpters =
>
> 'mcc'
> 'mwadlink'
> 'nidaq'
> 'parallel'
> 'winsound'
>
> >> ADLINK_INFO = daqhwinfo('mwadlink')
>
> ADLINK_INFO =
>
> AdaptorDllName: 'C:\ADLINK\DAQ-MTLB\DLL\mwADLINK.dll'
> AdaptorDllVersion: '1, 2, 0, 0'
> AdaptorName: 'mwadlink'
> BoardNames: {'PCI-7300'}
> InstalledBoardIds: {'0'}
> ObjectConstructorName: {'' '' ''}
>
>
> Clearly, MATLAB recognizes the ADLink adapter. However, it returns an empty array of object constructors...
>
> So when we attempt to create a digitalio object (using MATLAB's DAQ toolbox), MATLAB experiences a Segmentation Violation.
>
> ...Does anyone have any idea how to resolve this? I'm not finding anyone with similar issues on internet message boards.
>
> (PS, this occurs across computers, and across versions of MATLAB...)
>
> SYSTEM INFO:
> ==================================================
> MATLAB Version 7.6.0.324 (R2008a)
> Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
> Java VM Version: Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
> -------------------------------------------------------------------------------------
> MATLAB Version 7.6 (R2008a)
> Data Acquisition Toolbox Version 2.12 (R2008a)

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Remhibou

Date: 20 Nov, 2009 13:50:39

Message: 3 of 10

Hello,

I allow myself to contact you because I saw your comment about a Matlab crach when using the DAQ toolbox of Matlab with a 7300A card from ADLink and I currently experience the same problem as you.

I actually would like to control a PCI-7330A card form ADLink with the DAQ toolbox of Matlab but when I try to create a digital object with the DAQ toolbox, Matlab experiences a 'Segmentation violation' due to the fact that Matlab return an empty array for the object constructor.

Thus, I would like to know if you succed in solving this problem, and if you know if it is possible or not to control this kind of card with the DAQ toolbox of Matlab?

(SYSTEM INFO:
MATLAB Version 7.8.0.347 (R2009a)
Operating System: Microsoft Windows XP 2002 Service Pack 3
Data Acquisition Toolbox Version 2.1 (R2009a))

Thanks in advance,
Best regards,

Rémi

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Heather

Date: 20 Nov, 2009 14:22:23

Message: 4 of 10

Hi R?mi,

All I know is what I posted in the second post above... I'm not sure about the 7330A, but with the 7300A, I found that despite what ADLink advertises, the 7300A isn't truly compatible with the DAQ toolbox. That is, you can only use the DAQ on the 4 auxillary IO channels and not on the 32 high speed channels.

So no, I never got it working since this type of operation wasn't supported by ADLink or Mathworks.

Instead, I had to write MEX wrappers around my MATLAB code that directly interfaced with ADLink's API in order to successfully output data on the 32 high speed channels.

Hope this helps.



Remhibou <rgalland@spectro.ujf-grenoble.fr> wrote in message <1600361895.12147.1258725069387.JavaMail.root@gallium.mathforum.org>...
> Hello,
>
> I allow myself to contact you because I saw your comment about a Matlab crach when using the DAQ toolbox of Matlab with a 7300A card from ADLink and I currently experience the same problem as you.
>
> I actually would like to control a PCI-7330A card form ADLink with the DAQ toolbox of Matlab but when I try to create a digital object with the DAQ toolbox, Matlab experiences a 'Segmentation violation' due to the fact that Matlab return an empty array for the object constructor.
>
> Thus, I would like to know if you succed in solving this problem, and if you know if it is possible or not to control this kind of card with the DAQ toolbox of Matlab?
>
> (SYSTEM INFO:
> MATLAB Version 7.8.0.347 (R2009a)
> Operating System: Microsoft Windows XP 2002 Service Pack 3
> Data Acquisition Toolbox Version 2.1 (R2009a))
>
> Thanks in advance,
> Best regards,
>
> R?mi

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Petteri T

Date: 20 Nov, 2009 14:42:04

Message: 5 of 10

"Heather " <heather.c.miller@gmail.com> wrote in message <he68mv$fcp$1@fred.mathworks.com>...
>
> All I know is what I posted in the second post above... I'm not sure about the 7330A, but with the 7300A, I found that despite what ADLink advertises, the 7300A isn't truly compatible with the DAQ toolbox.

I participate to this also after buying PCI-9222 card from ADLink in a belief that it could be easily used with Matlab as the datasheet had a mention about the Matlab adapter being supported.

I also got the error of 'Segmentation violation' when just trying the card in Matlab and wrote to ADLink technical support asking for help but to my surprise I got the reply that the current version of the Matlab adapter does not even support the card that I bought. Apparently there is a new version of the adapter toolbox coming in Decmebr which should fix the problem.

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Remhibou

Date: 23 Nov, 2009 08:52:00

Message: 6 of 10

Thank you very much for your answer,

So we can say that ADLink made misleading advertising on their Matalb adtaper...

I would nevertheless be very interrested to know in which language you wrote your MEX wrappers for directly interfacing your Matlab code with ADLink's API. Is it very complicated to made this for someone who didn't master such a language?

Thank you for your help,
Best regards,
Remi

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Heather

Date: 24 Nov, 2009 09:06:01

Message: 7 of 10

Yes, ADLink certainly did misleadingly advertise when they advertised that the card could seamlessly integrate with MATLAB's DAQ toolbox... It is implied by this advertisement that the main feature of the card-- in my case, 32 high-speed DI/O -- would be able to interact with the DAQ toolbox. Not the case, I'm afraid...

It'd be interesting to see if ADLink does in fact release a new adapter in December that overcomes this limitation. Though, I would still be skeptical-- if you were using the DIO card as I was, you would presumably depend on the speed of the card. Since MATLAB is a software process, your timing could be off by tens of milliseconds (if timing is important to your application). In my case, it was, so even if the DAQ toolbox worked properly with our card, I presume we still would have had issues using it for our application.

Instead, the MEX wrappers solved most if not all possible problems with timing.

MEX took a while to get down-- it's sort of a hybrid of languages. It's C++, but there's a lot of conditioning that must be done to translate variables from MATLAB-land into C++-land. This conditioning isn't exactly C++, as you would expect it.

If you are going to take the MEX route, I have the following suggestion:
Go online, find a MEX tutorial and make a code template from the MEX tutorial. Then, just fill in variables and functions according to your needs.

Essentially, all you are doing with this MEX wrapper is 1) translating MATLAB variables into C++ variables, and 2) feeding these new C++ variables into functions from the ADLink API.

So, to do this, you need basic knowledge of C++, and you need to study two things:
1) MATLAB's MEX functions (for translating from MATLAB-land to C++-land)
2) ADLink's API -- so you can know which ADLink functions will give you the output you want.


Hope this helps
-H


Remhibou <rgalland@spectro.ujf-grenoble.fr> wrote in message <1706176004.22747.1258966350475.JavaMail.root@gallium.mathforum.org>...
> Thank you very much for your answer,
>
> So we can say that ADLink made misleading advertising on their Matalb adtaper...
>
> I would nevertheless be very interrested to know in which language you wrote your MEX wrappers for directly interfacing your Matlab code with ADLink's API. Is it very complicated to made this for someone who didn't master such a language?
>
> Thank you for your help,
> Best regards,
> Remi

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Petteri T

Date: 10 Dec, 2009 16:42:20

Message: 8 of 10

"Heather " <heather.c.miller@gmail.com> wrote in message <heg7lp$r7l$1@fred.mathworks.com>...
>
> If you are going to take the MEX route, I have the following suggestion:
> Go online, find a MEX tutorial and make a code template from the MEX tutorial. Then, just fill in variables and functions according to your needs.

Heather or someone else,

Has anyone tried to access the counters in ADLINK cards from Matlab and Data Acquisition Toolbox and if so would someone be willing to provide example code for that.

I realize that the counter/timer functions are not supported by Matlab DAQ toolbox but they could be accessed using MEX-files. And does it really differ from the approach taken for NI cards?
http://www.mathworks.com/matlabcentral/fileexchange/2800-generic-dll-front-end

Thank you,
Petteri

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Heather

Date: 10 Dec, 2009 22:07:04

Message: 9 of 10

> Has anyone tried to access the counters in ADLINK cards from Matlab and Data Acquisition Toolbox and if so would someone be willing to provide example code for that.

By counters, are you referring to the auxiliary lines? If so, yes, we've used them. I would give you a code example, but the code is the property of the lab I used to work for-- I wouldn't feel right posting on the internet. And it probably wouldn't help you, it's a bit specific. Not a good learning example.

Though the concept is pretty simple...
Best thing to do is to start by looking at a Mathworks-provided MEX template... Just copy/paste the following into the Command Window,
edit([matlabroot,'/simulink/src/sfuntmpl_basic.c']);

Most of your code in a MEX file is going to be devoted to the handover of variables from MATLAB-land to C-land. I think that's covered in the above example. After that, all you have to do is call one function from the ADLink API to output on the AUX lines.

My best advice to you is to just begin playing around with it.

Subject: ADLink DAQ card + DAQ Toolbox = MATLAB Crash

From: Petteri T

Date: 4 Jan, 2010 14:45:21

Message: 10 of 10

"Heather " <heather.c.miller@gmail.com> wrote in message <hfrre8$koe$1@fred.mathworks.com>...
> > Has anyone tried to access the counters in ADLINK cards from Matlab and Data Acquisition Toolbox and if so would someone be willing to provide example code for that.
>
> By counters, are you referring to the auxiliary lines? If so, yes, we've used them. I would give you a code example, but the code is the property of the lab I used to work for-- I wouldn't feel right posting on the internet. And it probably wouldn't help you, it's a bit specific. Not a good learning example.

Thanks for the reply. With counters I was referring to the "Programmable I/O function" in PCI-9222 for example http://www.adlinktech.com/PD/web/PD_detail.php?pid=735 with is capable of counting pulses or outputting signal and in our case I would to output PWM signal using the counter block which is not directly supported by MATLAB.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
daq Petteri T 10 Dec, 2009 11:44:15
data acquisitio... Petteri T 10 Dec, 2009 11:44:15
timer Petteri T 10 Dec, 2009 11:44:15
counter Petteri T 10 Dec, 2009 11:44:15
segmentation vi... Heather 24 Jun, 2009 14:34:03
objectconstruct... Heather 24 Jun, 2009 14:34:03
digitalio Heather 24 Jun, 2009 14:34:03
adlink Heather 24 Jun, 2009 14:34:03
rssFeed for this Thread

Contact us at files@mathworks.com