The first DAQ function called automatically calls Init_DA_Brds, which has the nasty sideffect of resetting the digital lines on the DAQ card. It has been posted that the undocumented function Init_DA_Brds2 can be used to prevent Init_DA_Brds from being called. I could not find the function in the .lib file associated with nidaq32.dll, so instead called the .dll directly:
HINSTANCE LibHnd = LoadLibrary("nidaq32.dll");
typedef i16 (WINAPI *Init_DA_Brds2_Type)(i16, i16 FAR *);
Init_DA_Brds2_Type prcPtr = (Init_DA_Brds2_Type) GetProcAddress(LibHnd,"Init_DA_Brds2");
int result = -1;
if(prcPtr != NULL)
result = prcPtr(m_deviceNumber, &m_deviceCode);
FreeLibrary(LibHnd);
Unfortunately,
Init_DA_Brds2 causes a stack corruption (which the compiler suggests is because of using the wrong calling convention). However, replacing "Init_DA_Brds2" by "Init_DA_Brds" works.
My concern is not having the digital lines reset. What's the best workaround?
(I'm using NI-DAQ 6.9.3 and Measurement Studio .NET for Windows XP)