User`s guide

56 Operation Theorem
4.7 Interrupt Control
The PCI-8134 motion controller can generate INT signal to host PC
according to 13 types of factors, refer to set_int_factor() function for more
details.. The INT signal is output when one or more interrupt factors occur
on either axis. To judge on which axis the interrupt factors occur, use
get_int_axis() function. The interrupt status is not closed until
get_int_status() function is performed. There is a little difference between
using DOS or Windows 95/NT to perform interrupt control. Users should
refer to Section 6.17 for more details. Here we use an example on Windows
OS to demonstrate how to perform interrupt control with the function library
we provided.
Use Thread to deal with Interrupt under Windows NT/95
In order to detect the interrupt signal from PCI-8134 under Windows NT/95,
user must create a thread routine first. Then use APIs provided by PCI-
8134 to get the interrupt signal. The sample program is as follows:
Situatuins: Assume that we have one card (4 axis) and want to receive
Home Return and Preset Movement Finish interrupt signal from axis 2.
Steps:
1. Define a Global Value to deal with interrupt event
HANDLE hEvent[4];
volatile bool ThreadOn;
2. In Initializing Section ( you must Initialize PCI-8134 properly first),
set interrupt types and enable an event for each axis.
set_int_factor(2,0x002040);
W_8134_Set_INT_Control (0,1);
W_8134_INT_Enable (0,&hEvent[0]);
Note: For each card, you must assign a 4-events -array in
W_8134_INT_Enable function.
3. Define a Global Function (Thread Body). Use WaitForSingleObject()
or WaitForMultipleObjects() to wait events. Remenber to reset this
event after you get the event.
UINT IntThreadProc(LPVOID pParam)