Hi all,
I am a newbie with NI products. I have the NIDAQ-dig-24 board tested with example reading from and writing to port A working properly with below code. Tools: Opering system windows 2000, micro Visual Studio.net 2003.
I would like to use this board to collect data from Port A of this board, and data from comport 1 through RS232 9connected to other computer at the transient signal comes to pin 7 or STRBA*.
But I don't know how to make an interrupt routine with the NIDAQ-dig-24.
Any one has an idea ? or eaxample code will be appreciated.
Is this board suitable for my requirement ? if no, what board do should I have ?
What is RS232 comport and PCI's interrupt more priority in windows 2000? To micro controller, I can handle this issue easilly, but I am dumb in this field.
How can (or should) I re-arrange priority interrupt for comport and PCI
Thanks for reading and help.
Loc
#include "nidaqex.h"
main()
{
i16 iStatus1 = 0;
i16 iStatus2 = 0;
i16 iRetVal = 0;
i16 iDevice = 1; /*assigned by Measurement & Automation Explorer*/
i16 iPort1 = 0;
i16 iPort2 = 1;
i16 iMode = 1; /*configured for handshaking*/
i16 iDir = 0; /*configured as an input port*/
i32 iPattern1 = 0;
i32 iPattern2 = 0;
i16 iLatched = 0;
i16 iIgnoreWarning = 0;
i16 iYieldON = 1;
i16 i = 0;
While(TRUE) //loop forever
{
/* Configure port as input, handshaking (latched mode). */
iStatus1 = DIG_Prt_Config(iDevice, iPort1, iMode, iDir);
iStatus2 = DIG_Prt_Config(iDevice, iPort2, iMode, iDir);
iRetVal = NIDAQErrorHandler(iStatus1, "DIG_Prt_Config", iIgnoreWarning);
iRetVal = NIDAQErrorHandler(iStatus2, "DIG_Prt_Config", iIgnoreWarning);
printf(" Apply your handshaking signal to the appropriate handshaking I/O pin for input.\n");
/* Loop until data is latched in. */
while ((iLatched == 0) && (iStatus1 == 0)) {
iStatus1 = DIG_Prt_Status(iDevice, iPort1, &iLatched);
iRetVal = NIDAQYield(iYieldON);
}
// RS232(); //for future reqirement
iStatus1 = DIG_In_Prt(iDevice, iPort1, &iPattern1);
iStatus1 = DIG_In_Prt(iDevice, iPort2, &iPattern2);
iLatched = 0;
iRetVal = NIDAQErrorHandler(iStatus1, "DIG_Prt_Status", iIgnoreWarning);
iRetVal = NIDAQErrorHandler(iStatus1, "DIG_In_Prt", iIgnoreWarning);
printf(" The digital pattern on port %d is (DECIMAL) %ld\n", iPort1, iPattern1);
printf(" The digital pattern on port %d is (DECIMAL) %ld\n\n", iPort2, iPattern2);
}
return 0;
}
/* End of program */