hi Nick F.
My brd is:NiDAQ DIO24 (6503),
I send trigger to portA bit0.
when I use "Measurement & Automation" AP to get trigger, it is ok to get trigger!
But run my code to callback is fail.
need help to tell me what is wrong?
thanks
MY code :
#include "nidaqex.h"#include "nidaq.h"//typedef void (* CALLBACK) (int , int , unsigned , unsigned long )void CallBackfun (int handle, int msg, unsigned wParam, unsigned long lParam);
i16 iNum = 0;i16 temp;
/* ================================================================= */void main (void)
{ /*Local Variable Declarations*/ i16 iStatus = 0; i16 iRetVal = 0; i16 iDevice = 1; i16 iGroup = 1; static i16 portList[1] = {0}; static i16 piBuffer[100] = {0}; u32 ulRemain = 100; i16 iIgnoreWarning = 0; i16 iYieldOn = 1; i16 i = 0;
iStatus = Init_DA_Brds (iDevice, &temp); /* Resets the board */ iRetVal = NIDAQErrorHandler(iStatus, "Init_DA_Brds", iIgnoreWarning);
/* Sets up so a 1 on digital port 0, line 0 generates a interrupt */ iStatus = Config_DAQ_Event_Message (iDevice, 1, "DI0", 8, 1, 1, 0, 0, 0, 0, 0, (unsigned long)&CallBackfun); //
//iStatus = Config_DAQ_Event_Message (iDevice, 1, "DI0", 8, 2, 2, 0, 0, 0, 0, 0, (unsigned long)CallBack); //I try it but result is fail
//
iRetVal = NIDAQErrorHandler(iStatus, "Config_DAQ_Event_Message", iIgnoreWarning);
/* Read 100 elements from Dig Port 0 (And check for our 1 on line 0) */ iStatus = DIG_SCAN_Setup(iDevice, iGroup, 1, portList, 0);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_SCAN_Setup", iIgnoreWarning);
iStatus = DIG_Block_In(iDevice, iGroup, piBuffer, 100);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_Block_In", iIgnoreWarning);
while (ulRemain > 0 && i < 1000)
{ iStatus=DIG_Block_Check (iDevice, iGroup, &ulRemain);
iRetVal=NIDAQYield(iYieldOn);
i++; printf("# of events generated %d.\n", iNum); /* Print how many interrupts we saw */ }
if (ulRemain == 100 && i == 1000) {
printf("No STB provided.\n"); }
else {
printf("Operation completed.\n"); }
getchar();}
/* ================================================================= */void CallBackfun (int handle, int msg, unsigned wParam, unsigned long lParam){ iNum++; //<==I set breakpoint in here.but no any response.}