Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of return value from DAQmxEveryNSamplesEventCallbackPtr

When using DAQmxRegisterEveryNSamplesEvent, the function pointer type DAQmxEveryNSamplesEventCallbackPtr is declared as returning an int32.  Does NI-DAQmx do anything with this value?  All the examples I've seen only return 0.

Also I've tried to figure out where best to put the DAQmx C api questions.  It seems there are more questions in this forum than Measurement Studio C++.
0 Kudos
Message 1 of 5
(3,619 Views)
Hi CVilla,
 
The return value from DAQmxRegisterEveryNSamplesEvent is the error code returned by the function in the event of an error or warning; a value of 0 indicates success, a positive value indicates a warning, and a negative value indicates an error. The NI-DAQmx C Reference Help is a great resource to use when programming DAQmx in C. This can be found in your Start Menu under National Instruments » NI-DAQ.
 
As for posting DAQmx C API questions, this is the proper forum to post such questions as programming DAQmx still falls under the umbrella of Multifunction DAQ.
 
I hope this helps,
S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 2 of 5
(3,594 Views)
I guess my question was not clear.  I understand the return values when my code calls DAQmx functions.  The return value constants are in the header file.

What I do not understand, which is not described in the C api help file, is what does DAQmx do with the return code from my event function?

If I write a function and register it with DAQmxRegisterEveryNSamplesEvent like this:

DAQmxRegisterEveryNSamplesEvent(..., MyFunction, ...)

int32 MyFunction(...)
{
// do stuff here
if (ok)
    return 0;
else
    return -1;
}

When the DAQmx thread calls my function and I return a value, what does DAQmx do with the return value?  If I return -1 instead of 0 does DAQmx behave differently?  If so, how?
0 Kudos
Message 3 of 5
(3,584 Views)
The return value from your C API callbacks is ignored by the API as of now.

Hope this helps.
LDP
0 Kudos
Message 4 of 5
(3,581 Views)
OK - thanks!
0 Kudos
Message 5 of 5
(3,578 Views)