53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾĿ<CABE>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>λ<EFBFBD>ȡ<EFBFBD>ж<EFBFBD><D0B6>¼<EFBFBD>,ֻ<>иı<D0B8>DI0<49><30>״̬ʱ<CCAC>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XF1<46><31>1<EFBFBD><31>2<EFBFBD><32><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
|||
|
|
// DI0Ϊ<30>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϣ<D0B6>2<EFBFBD><32>3<EFBFBD><33><EFBFBD><EFBFBD>Ϊ<EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
|
|||
|
|
#include "stdafx.h"
|
|||
|
|
#include "windows.h"
|
|||
|
|
#include "stdio.h"
|
|||
|
|
#include "conio.h"
|
|||
|
|
|
|||
|
|
#include "PCI2312.h"
|
|||
|
|
|
|||
|
|
int main(int argc, char* argv[])
|
|||
|
|
{
|
|||
|
|
HANDLE hDevice, hEventInt;
|
|||
|
|
int DeviceID;
|
|||
|
|
DeviceID = 0;
|
|||
|
|
int inIntCount = 0; // <20>ڲ<EFBFBD><DAB2>жϼ<D0B6><CFBC><EFBFBD>
|
|||
|
|
int outIntCount = 0; // <20>ⲿ<EFBFBD>жϼ<D0B6><CFBC><EFBFBD>
|
|||
|
|
hDevice = PCI2312_CreateDevice( DeviceID ); // <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
if(hDevice == INVALID_HANDLE_VALUE)
|
|||
|
|
{
|
|||
|
|
printf("CreateDevice Error...\n");
|
|||
|
|
_getch();
|
|||
|
|
goto Exit;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
hEventInt = PCI2312_CreateSystemEvent(); // <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if(hEventInt == INVALID_HANDLE_VALUE)
|
|||
|
|
{
|
|||
|
|
printf("CreateSystemEvent Error...\n");
|
|||
|
|
_getch();
|
|||
|
|
goto Exit;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
PCI2312_InitDeviceInt(hDevice, hEventInt); // <20><>ʼ<EFBFBD><CABC><EFBFBD>ж<EFBFBD>
|
|||
|
|
printf("Wait....\n");
|
|||
|
|
while(!_kbhit())
|
|||
|
|
{
|
|||
|
|
while(1)
|
|||
|
|
{
|
|||
|
|
if(WaitForSingleObject(hEventInt, 100) == WAIT_OBJECT_0) // <20>ȴ<EFBFBD><C8B4>жϷ<D0B6><CFB7><EFBFBD>
|
|||
|
|
break;
|
|||
|
|
if(_kbhit()) break;
|
|||
|
|
}
|
|||
|
|
outIntCount++; // <20>ⲿ<EFBFBD>жϼ<D0B6><CFBC><EFBFBD>
|
|||
|
|
inIntCount = PCI2312_GetDeviceIntCount(hDevice); // <20><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2>жϼ<D0B6><CFBC><EFBFBD>
|
|||
|
|
printf("outIntCount=%d, inIntCount=%d\n", outIntCount, inIntCount);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Exit:
|
|||
|
|
PCI2312_ReleaseDeviceInt(hDevice); // <20>ͷ<EFBFBD><CDB7>ж<EFBFBD><D0B6><EFBFBD>Դ
|
|||
|
|
PCI2312_ReleaseDevice(hDevice); // <20>ͷ<EFBFBD><CDB7>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
return 0;
|
|||
|
|
}
|