Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxErrChk(functionCall)

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error;

DAQmxErrChk(functionCall)
DAQmxFailed(error=(functionCall))

How do these 2 statements work in conjunction with the #define.

I am building on the example software for DAQmx Acq-IntClk.
I keep receiving the following compile error.
  118, 9   Undeclared identifier 'DAQmxErrChk'.




0 Kudos
Message 1 of 4
(7,603 Views)
Hi Rich,

Are you making the call "DAQmxErrChk(functionCall)"?  The call to DAQmxErrChk is looking for a function call as the parameter, and does not recognize the term "functionCall".  You mention that you are building on the example code; is the line of code that is returning the compile error an addition that you have made to it?  If so, verify that the parameter that you are passing is a valid DAQmx function.

Regards,
Andrew W
National Instruments
0 Kudos
Message 2 of 4
(7,579 Views)

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

is the declaration of the Macro (as in the examples)

The first call

  /*********************************************/
  // DAQmx Configure Code
  /*********************************************/
  DAQmxErrChk (DAQmxErrChk = DAQmxCreateTask ("", &taskHandleAnalog2));
  DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleAnalog2,chanAnalog2,"",min,max,DAQmx_Val_Volts,""));

produces this error   109, 9   Undeclared identifier 'DAQmxErrChk'.

When I check the project / Macros / DAQmxErrCheck is not listed

In the example code project / Macros / DAQmxErrChk is listed along with DAQmxFailed

I have searched for "How To Register" a macro, and can not find any information.

I have edited the Example Acq-IntClk.c and it performs my task very well.

We are using the USB-6008 in 7 locations. We needed to identify 2 special setups.

We jumpered the Analog I/O side to identify these setups.

I have "Cut & Pasted" the necessary code from the Example Acq-IntClk.c into our main code.

I am receiving the above mentioned error. Can you help ?

 

0 Kudos
Message 3 of 4
(7,571 Views)
Hi Rich,

It looks like the error is in the parameter you are passing to the first DAQmxErrChk call in the "DAQmx Configure Code" section.  The Acq-IntClk.c example has the first call as DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

Modify your first function call to
the following:
DAQmxErrChk (DAQmxCreateTask ("", &taskHandleAnalog2));

DAQmxErrChk is looking for any DAQmx function name as a parameter.

Regards,
Andrew
0 Kudos
Message 4 of 4
(7,549 Views)