Hello To All:
My question is about the DAQmxErrChk call. I have a program that is controlling actuators, the problem is when and if i get a DAQmxErrChk error the program immediatly puts up a popup and locks the program, this is bad, very bad. Lets say i have a command for the actuator to go foward as soon as the DAQmxErrChk is triggered the program will stop processing but the actuator will still continue to move fwd because the command cannot change inn the program. I am still in the baby steps of the program but if this Error were to happen how can i run a routine before the popup happens, to ensure the actuators are in a safe condition before the popup / lockout occurs. Here is an example code, obviously if the program cannot read the inputs fast enough i get an error which is what i want to see, but i want to put the actuator in a safe state before the message occurs
steps with the controlstop() function
1) placing it after the ERROR as below (that gets called immediatly afer the top code is completed)
2) placing it after the if statment: when the error happens it is called after the popup? this makes no since, because the popup is after the function call
3) putting return 0 values before the ERROR still popup is called before the ERROR.
what i want is to find where i can call my function before the stupid popup kills the program..
int32 CVICALLBACK EveryNSamplesCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
int32 error=0;
uInt32 numRead;
char errBuff[2048]={'\0'};
DAQmxErrChk (DAQmxReadAnalogF64 (gDAQTaskHandleAI, nSamples, 10.0, DAQmx_Val_GroupByScanNumber, gDataAI, nSamples*gNumChannels, &gNumReadAI, NULL));
if( gNumReadAI>0 )
{
//thread out data input
SeperateDataCallbackThread1(0);
}
Error:
ControlStop();
if( DAQmxFailed(error) )
{
DAQmxGetExtendedErrorInfo(errBuff,2048);
MessagePopup("DAQmx Error",errBuff);
}
return 0;
}