I’m using a A/D ISA board (keithley DAS-1802HR) on QNX 6.3.0 service Pack 2 for data collection. The counter on this board is programmed to generate interrupt to the host. My problem is: the ISR which is attached to the IRQ never get called when the interrupt is generated, I can check from the status register on the board that the interrupt does occur. Here is my code related with the interrput process. What’s wrong with my code?
#define IRQ 5
#define base_add 0x300 //ISA board address
int count = 0;
extern const sigevent *send_control(void *arg, int id)
{
count += 1;
//check the status register on the board to interrupt
if(!(int8(base_add+7) & 0x1))
return NULL;
//do some A/D reading
…
}
int main()
{
int interpt_no;
int ttl_cnt = 1000;
if(ThreadCtrl(_NTO_TCTL_IO, 0) == -1)
exit(1);
//initiate the board
…
//set interrupt routine
InterruptDisable();
interpt_no = InterruptAttach(IRQ, send_control,
NULL, 0, _NTO_INTR_FLAGS_TRK_MSK);
if(interpt_no == -1)
return -1;
out8(base_add+5,0xd0) //set board interrupt level to IRQ:5
out8(base_add+7,0x80) //start counter on the board
InterruptUnmask(IRQ, interpt_no);
InterruptEnable();
while(count < ttl_cnt)
{
InterruptWait(0, NULL);
printf(“interrupt! count is %d\n”, count);
InterruptUnmask(IRQ, interpt_no);
}
out8(base_add+5,0x00) //disbable board interrupt
if(InterruptDetach(interpt_no) == -1)
printf(“detach error\n”);
return 0;
}
The ISR “send_control” never get called even if an interrupt occured, which I can check from the status register after the program running. Can somebody help me out?
Thanks!
Yicheng