LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LVBasicBT252Test call crashes system after 1409 upgrade

Hello -

I'm working on an application written in VC++ 6.0 on Windows 2000 Professional that uses the NI-IMAQ 1408 image acquisition card.

The application has been functioning properly on systems with the IMAQ 1408 card installed.
I've just upgraded to a 1409 card and now when I run the application it crashes the machine, a complete restart.

After reading through some of the posts on this forum I turned off the auto-reboot recovery setting and now I get the blue-screen with the message:

KMODE_EXCEPTION_NOT_HANDLED
** ADDRESS BFD70386 base at BFD63000, DateStamp 3f8abf42 - pciimaq.sys

Here is the chunk of code that is causing the problem:
---------------------
extern "C" {char _cdecl LVBasicBT252Test (unsigned int serial_number, char* details);}
extern "C" {char _cdecl LVBasicBT261Test (unsigned int serial_number, char* details);}
extern "C" {char _cdecl LVBasicSRAMTest (unsigned int serial_number, char* details);}
extern "C" {char _cdecl LVBasicTrigTest (unsigned int serial_number, char* details);}
extern "C" {char _cdecl LVBasicInt0Test (unsigned int serial_number, char* details);}
extern "C" {char _cdecl LVBasicFPGATest (unsigned int serial_number, char* details);}

// Initialize IMAQ Card through the use of IMAQ diagnostic tests
DWORD CImaq::InitializeCard()
{
unsigned int serial_number;
char details[132];
DWORD dwReturn = ERROR_SUCCESS;

// Need the serial number
dwReturn = imgGetAttribute (m_SessionID, IMG_ATTR_GETSERIAL, &serial_number);

// Code section below initializes IMAQ Card through the use of IMAQ diagnostic tests
dwReturn = LVBasicBT252Test(serial_number, details); // THIS LINE IS CRASHES THE SYSTEM
dwReturn = LVBasicBT261Test(serial_number, details);
dwReturn = LVBasicSRAMTest(serial_number, details);
dwReturn = LVBasicTrigTest(serial_number, details);
dwReturn = LVBasicInt0Test(serial_number, details);
dwReturn = LVBasicFPGATest(serial_number, details);

return dwReturn;
}
------------------------

I have no idea where the LVBasicBT252Test() or the other 5 LVBasic***Test() methods are implemented. I search my entire codebase and see nothing.

Prior to installing the 1409 hardware I installed the latest 2.6.1 build of the IMAQ software I downloaded from this site. As well, in my Project Settings/Link Options, I have these IMAQ related files listed:

..\3rdParty\National_Instruments\imaq.lib
..\3rdParty\National_Instruments\test1408.lib

(side question - what does test1408.lib perform? why didn't my new installation provide a test1409.lib file?)


Does anybody have any suggestions?

thanks
Paul
0 Kudos
Message 1 of 4
(2,728 Views)
mound wrote:

> Prior to installing the 1409 hardware I installed the latest 2.6.1
> build of the IMAQ software I downloaded from this site. As well, in my
> Project Settings/Link Options, I have these IMAQ related files listed:
>
> .\3rdParty\National_Instruments\imaq.lib
> .\3rdParty\National_Instruments\test1408.lib
>
> (side question - what does test1408.lib perform? why didn't my new
> installation provide a test1409.lib file?)

I would say test1408.lib implements your LVBasicxxxTests. Would be
interesting to know where you got that lib from but from the naming it
is also rather obvious that it will not work with the 1409 card as it
most probably tries to access the card on such a low level that it
accesses specific 1408 resources and registers, which the
1409 might not
have or have differently. So I'm not surprised your program crashes. I'm
also quite sure that initialization of hardware with a lowlevel hardware
test library, no matter from where it is seems not a very good idea.

Using the officially documented NI-IMAQ functions instead would sound to
me like a much more sensible approach and would have a good chance to
work with both cards without crash.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 4
(2,728 Views)
Yeah, since posting this I did determine that the LVBasicXXXTest were within the Test1408.dll at which point it was obviously the source of the crash. (Note, I didn't write any of this code, I'm jumping in to an existing project here to make it work with the 1409.)

The LIB file, assuming from your comments that it didn't ship with the IMAQ 1408 installation, was likely generated using a LIB /DEF: Test1408.dll call in DOS (at least that's how I generated a corresponding LIB file for Test1490.dll.)

That said, if using these low level test methods is not an appropriate design choice, I have to wonder why the first developer did so, and even how he learned of the functions if they are not documented. Is there a more appropriate way to initialize the IMAQ ca
rd? There must have been a reason he did it this way.

In my case I ended up creating a LIB file for the 1409, and by doing a DUMPBIN to see the methods the Test1409.dll provided, I did a conditional set of calls to it's library of functions.. Perhaps though from what you're saying this whole approach is dangerous.

-Paul
0 Kudos
Message 3 of 4
(2,728 Views)
mound wrote:

> In my case I ended up creating a LIB file for the 1409, and by doing a
> DUMPBIN to see the methods the Test1409.dll provided, I did a
> conditional set of calls to it's library of functions.. Perhaps though
> from what you're saying this whole approach is dangerous.

Well, it is dangerous in the sense that this DLL is for a specific card.
Changing cards will cause problems. I think it is the DLL used by
Measurement & Automation Explorer to test the different cards. So a new
version of Measurement & Automation Explorer may install a new version
of those DLLs and although it knows how to call that DLL your
application will attempt to call it in the old way.

In general you should not need to call such functions to get the IMAQ
c
ard initialized. The NI-IMAQ Programmers Reference manual should show
you how to initialize any IMAQ card in a consistent way. I have little
experience with the C API of NI-IMAQ but from what I remember
intializing any IMAQ card should be something like this:

char interfaceName[INTERFACE_NAME_SIZE];
INTERFACE_ID intf;
uInt32 sessId;

if (err = imgInterfaceOpen(interfaceName, &intf))
return err;

if (err = imgSessionOpen(intf, &sessId))
return err;

/* Set all the attributes to initialize the hardware correctly */
err = imgSetAttribute(sessId, IMG_ATTR_Some_Attr, some_value);

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(2,728 Views)