ADLINK PCI-8164 User Manual

Page 155

Advertising
background image

Operation Theory

143

Use Events to handle interrupts under Windows

To detect an interrupt signal from the card in Windows, you must
first create an events array, then use the functions provided by the
card to obtain the interrupt status. A sample program is listed
below:

Steps:

1. Define a Global Value to deal with interrupt events. Each

event is linked to an axis

HANDLE hEvent[4];

2. Enable interrupt event service and setup interrupt factors

and enable interrupt channel

_8164_int_enable(0,hEvent);
_8164_set_int_factor(0,0x01); // Normal Stop

interrupt

_8164_int_control(0,1);

3. Start move command

_8164_start_tr_move(0,12000,0,10000,0.1,0.1);

4. Wait for axis 0 interrupt event

STS=WaitForSingleObject(hEvent[0],15000);
ResetEvent(hEvent[0]);

if( STS==WAIT_OBJECT_0 )
{
_8164_get_int_status(0, &error, &event);
if( event == 0x01 ) …… ; // Success
}
else if( STS==WAIT_TIME_OUT)
{

// Time out, fail

}

Advertising