LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxErrChk entry point

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;
}

0 Kudos
Message 1 of 4
(4,559 Views)

Ok i think i figured it out after thinking about it for a min.

1) make all functions that have a DAQmxErrChk a  int function and return 0; before the Error call, that was working.

what i am seeing is the non-fatal runtime error popup that kills everything 😞 sorry for the misdiagnosi.s

as i continue i will possibly end up with a blog of dip stick mistakes

0 Kudos
Message 2 of 4
(4,558 Views)

One can disable those popups from the menu:

Just remove the check mark from Break On > Library Errors from the Run menu.

 

Even if enabled, they only appear in debug version.

If you build and run a release executable those popups will not be shown

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 4
(4,551 Views)

Break on library errors can be of some help in initial steps of development since it shows immediately where an error rises. For this reason you may wnat to keep it enabled but keep protecting the critical sections of your code surrounding them with calls to SetBreakOnLibraryErrors (). See the help for the function which describes quite well where and how to use the command.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,530 Views)