Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx version defined in DAQmx.h header ?

In NIDAQmx.h file I was not able to find a constant defining DAQmx version (for example _DAQMX_VER )
Does such constant exist ?

In fact I have one code using the now "obsolete" DAQmxIsReadOrWriteLate() function call and I would like to write a C code where the compiler can use DAQmxWaitForNextSampleClock if DAQmx version is 7.4+ and DAQmxIsReadOrWriteLate otherwise.
Regards, Philippe proud to be using LabWindows since version 1.2
// --------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 4
(4,001 Views)
To get the version:

int iVersion;
int error;
double version;
char temp2[64];

// Check NIDAQ version
DAQmxErrChk(DAQmxGetSystemInfoAttribute (DAQmx_Sys_NIDAQMajorVersion, &iVersion, 256));
Fmt(temp2,"%s<%d",iVersion);
Fmt(temp2,"%s[a]<.");
DAQmxErrChk(DAQmxGetSystemInfoAttribute (DAQmx_Sys_NIDAQMinorVersion, &iVersion, tempSize));
Fmt(temp2,"%s[a]<%d",iVersion);
version = atof(temp2); // this allows for minor version changes like 7.411
Fmt(temp2,"%s<%f",version);
if(version < 7.4){
MessagePopup("NIDAQ Version < 7.4 found",temp2);
error = ME_HARDWARE; // this is defined in my application's interface
goto Error;
}
// END Check NIDAQ version

My current project also needs NIDAQ 7.4.
0 Kudos
Message 2 of 4
(3,994 Views)
Thank you for your time and the sample code.
However, this is not exactly what I want to do.
Indeed I know the DAQmxGetSystemInfoAttribute function call. It works at run time.
What I need to do is to detect the Daqmx version at compile time

As usually, it will be easier with a C sample code 🙂
Here is what I would like to write :

#if defined (_DAQMX_VER) && (_DAQMX_VER <= 7300)
   if(DAQmxIsReadOrWriteLate (error)){
#else
   DAQmxWaitForNextSampleClock (ghOutTask, 10, &error);
   if(error){
#endif
      MessagePopup ("PID Whith Hard Timed Loop Error", "No way to sustain the rate in real time");
      gRunning=0;
}


Any idea ?
Regards, Philippe proud to be using LabWindows since version 1.2
// --------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 4
(3,987 Views)
Such a compile-time define doesn't exist in the NIDAQmx.h header file. My best suggestion for you is to key off of the attributes that are defined in the NIDAQmx.h header file.

For example, the attribute DAQmx_AI_RawDataCompressionType was first introduced in NI-DAQ 7.4, so you could do the following:

#ifdef DAQmx_AI_RawDataCompressionType
#define DAQmx_Version_Is_74_Or_Greater
#endif

Good luck,
Joe
0 Kudos
Message 4 of 4
(3,983 Views)