60
•
Operation Theorem
Use Thread to deal with Interrupt under Windows NT/95
In order to detect the interrupt signal from PCI-8136M under Windows NT/95,
user must create a thread routine first. Then use APIs provided by
PCI-8136M to get the interrupt signal. Each card has 7 events for these
interrupts. Event 0 ~ 5 stands for axis 0~5 and event 6 stands for timer
interrupt and alarm interrupt. The sample program is as follows:
Situatuins:
Assume that
we have one card and want to receive Timer
interrupt.
Steps:
1.
Define a Global Value to deal with interrupt event
HANDLE hEvent[7];
volatile bool ThreadOn;
2.
In Initializing Section ( you must Initialize PCI-8136M properly first),
set interrupt types and enable an event for each axis.
_8136_S_Set_Int_Factor(0,0, 0x40);
_8136_S_INT_Control(0,1);
_8136_INT_Enable(0,&hEvent[0]);
_8136_INT_Enable function.
Note:
For each card, you must assign a 7 -events-array in.
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)
{
U32 IntSts;
while(ThreadOn==TRUE)
{
::WaitForSingleObject(hEvent[6],INFINITE);
_8136_S_Get_Int_status(0,0,&IntSts);
::ResetEvent(hEvent[6]);
}
return 0;
}
Summary of Contents for PCI-8136M
Page 1: ...PCI 8136M 6 Axis Motion Controller Card User s Guide ...
Page 2: ......