Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Change Detection Timing event

Hi
 
Im using LabWindows CVI v8 and Im having problems with calling a function which contains the following standard CVI functions:

DAQmxCfgChangeDetectionTiming
DAQmxRegisterSignalEvent
The problem is I have put these in my own function of type    void functionname (); as shown below:
 
int CVICALLBACK starttestbutton_callback (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{  
     switch (event)
      {     case EVENT_LEFT_CLICK:
            function1();
            function2();
            etc
            functioname()
            function3();
            function4();
            break;
 }
 return 0;
}
  
When the function is called by my code, the function is executed but it doesn't work properly as the DAQmxRegisterSignalEvent callback function doesn't get called. However, if I call this function directly from a user interface command button as shown below, it executes fine.
 
int CVICALLBACK StartCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)

      if (event==EVENT_LEFT_CLICK)
      {     functionname();
      }
      return 0;
}
 
Are there some restrictions as to how these standard CVI functions are called?
Any help would be appreciated.
 
Thanks Andy
 

 

Message Edited by Andy_458233 on 03-29-2006 05:02 AM

Message Edited by Andy_458233 on 03-29-2006 05:05 AM

Message Edited by Andy_458233 on 03-29-2006 05:07 AM

0 Kudos
Message 1 of 2
(3,441 Views)
I have found a way round the problem by calling my function from within the following if statement which is in the same place as the original function call:
  
if (event==EVENT_COMMIT)
  {   
        functionname();
  }
  return 0;
 
It seems like the CVI functions require the return value or to be called by an event before they execute properly.
 

Message Edited by Andy_458233 on 03-29-2006 06:00 AM

0 Kudos
Message 2 of 2
(3,430 Views)