Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How Can I use Interrupt routine with NIDAQ card DIO-24

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 */
 
0 Kudos
Message 1 of 3
(3,365 Views)

Hello Loc,

Would you please explain what you mean by "interrupt routine?"  What exactly are you trying to accomplish?

Also, how are you going to acquire data from your COM port?  Are you planning on making VISA calls?  I don't understand how you would read data from the COM port with your DIO board...

Regards,
Sean C.

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

Hi Sean,

Thanks for reply. My purpose is: as soon as the alert signal (triggering edge) comes  my program promtly reads the 8 bit data from prort.A of NIDAQ DIO-24 board,  then reads 8 bit data through serial port (computer's comport 2).  Then my program comes back do normal other tasks without waiting for triggring signal.  That method is interrupt routine.  I found the Config_DAQ_Event_message function which may be help.  I will test it to see what happens, how fast it reacts.

Cheers

Loc

0 Kudos
Message 3 of 3
(3,347 Views)