Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Can ibsgnl() raise a signal on DTAS OR DCAS and how would the my signal handler know which event caused the signal?

Sample Code:

struct sigaction sa;


ibconfig(gi488Card, IbcSC, 0);
ibconfig(gi488Card, IbcPAD, 2);
ibconfig(gi488Card, IbcSAD, 0);
ibconfig(gi488Card, IbcAUTOPOLL, 0);
/* Change to SIGUSR1 instead of default SIGINT.
** In this way the process does not catch Ctrl-C
*/
ibconfig(gi488Card, IbcSignalNumber, SIGUSR1);
ibconfig(gi488Card, IbcTMO, T1s);

memset(&sa, 0, sizeof(sa));
sa.sa_handler = &Sig_Handler;
sigaction(SIGUSR1, &sa, NULL);

/* Signal on GET OR (DCL | SDC) */
ibsgnl(gi488Card, (DTAS | DCAS));

The handler
void Sig_Handler(int SigNum)
{
/* Update the current status of ibsta */
ibwait(gi488Card, 0);

if (ibsta &
DCAS)
{
printf("Caught sig DCL or SDC!\n\n");
gMode = DCL;
}
else if (ibsta & DTAS)
{
printf("Caught sig GET!\n\n");
gMode = GET;
}

}

The problem is the handler always says "GET" never
"SDC" even though the handler will be invoked because of a ibclr() from the CIC.

How can I differentiate between the two events?

I am using a NI PCI-GBIB card under linux 2.4.8 kernel with the NI 0.8.1 driver.
0 Kudos
Message 1 of 2
(3,156 Views)
Hello Joel,

Yes, you can use ibsgnl() to raise a signal on DTAS or DCAS. Your code appears to be correct. ibsta whould specify which event caused the signal. If this is not functioning properly, please contact National Instruments via email using www.ni.com/ask.

Have a good day.

Kim L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,156 Views)