Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

callback for a state change on digital Input 6025E

Hello All,

I need to have a callback function invoked when a state change occurs on serveral digital inputs (interlocks, kill button etc.).
I am using a PCI-6025E and traditional NI-DAQ. For test purposes I have connected the output P3.0 to the input P4.0 using a SCB-68
terminal block and initialize the ports in the following manner:

void initfunc()
{
long nPattern;

DIG_Prt_Config(1, 3, 0, 1); /* port 3 output */
DIG_Prt_Config(1, 4, 0, 0); /* port 4 input */
DIG_Out_Prt(1, 3, 0xff); /* set all outputs high */
DIG_In_Prt(1, 4, &nPattern); /* returns 0xff */
Config_DAQ_Event_Message (1, 1, "DI4", 8, 0xffff, 0xffff, 0, 0, 0, 0, 0, (unsigned long)(&myCallback)); /* callback on state change */
}


Now later in my program I perform the following (again as a test) when a button is pushed on a dialog box.

CDigioDlg::OnKillBtn()
{
DIG_Out_Line(1, 3, 0, 0);
DIG_In_Prt(1, 4, &nPattern); /* returns 0xfe */
}



My callback funtion never gets called on the state change. Now looking at the documentation for the Config_DAQ_Event_Message it says that
it notifies traditional NI-DAQ applications when the status of an asynchronous DAQ operation (initiated by a call to DAQ_Start, DIG_Block_Out, WFM_Group_Control, and so on) meets certain criteria you specify.

Eventually this routines will need to monitor these input lines continuously within a DLL. I want to call an initialization function within
the DLL to configure the board and callbacks then return. I want the callback functions within the DLL to handle these state changes.

Any help would be greatly appreciated,
John
0 Kudos
Message 1 of 2
(2,557 Views)
Hello John. Thank you for contacting National Instruments. It looks like you are using the callback incorrectly. I found an example that uses the callback in Visual C++ with Traditional DAQ. This isn't the same setup as you are using, but it should give you a good idea of how to setup the callback. Please let me know if you have any questions. Have a great day!

Marni S.
National Instruments
0 Kudos
Message 2 of 2
(2,543 Views)