
ICPDAS
I-8092F Software User Manual
75
Example:
HANDLE
hINT;
//Interrupt event handle
HANDLE
i8092_hThread;
//IST handle
DWORD WINAPI i8092_ThreadFunction(LPVOID lParam);
//IST function
BYTE CardNo=1;
BYTE
Slot1=1;
//MFC button event: Create the thread and set the interrupt factor
void
CI8092QCDlg::OnTestint()
{
DWORD dwThreadID = 0;
HWND hWnd = NULL;
//Create thread: i8092_ThreadFunction
i8092_hThread = CreateThread(NULL, 0, i8092_ThreadFunction, hWnd, 0,
&dwThreadID);
BYTE
axis=AXIS_XY;
i8092MF_SET_MAX_V(CardNo,
axis,
20000);
i8092MF_NORMAL_SPEED(CardNo,
axis,
0);
i8092MF_SET_V(CardNo,
axis,
20000);
i8092MF_SET_A(CardNo,
axis,
100000);
i8092MF_SET_SV(CardNo,
axis,
20000);
i8092MF_SET_AO(CardNo,
axis,
0);
//Initialize the interrupt
hINTP=Slot_Register_Interrupt(Slot1);
//Set the interrupt factor: D-END
i8092MF_INTFACTOR_ENABLE(CardNo,
AXIS_X,
7);
// 4-Axis fixed pulse drive
i8092MF_FIXED_MOVE(CardNo,
AXIS_XY,
10000);
while (i8092MF_STOP_WAIT(CardNo, 0xf) == NO)
{
//Wait for motion done
DoEvents();
Sleep(1);
}
}
//IST function
DWORD WINAPI i8092_ThreadFunction(LPVOID lParam)
{
DWORD
dwEvent;
WORD
RR3_X;
if(hINTP
!=
NULL)
{
//Wait the event object
dwEvent
=
WaitForSingleObject(hINTP,
INFINITE);
switch(dwEvent)
{