|
多搜索下 会有很多的
使用上很简单 初始化 InitializeWinIo---使用 ---关闭退出ShutdownWinIo
下面的摘抄给你。网址:http://topic.eeworld.net/u/20081223/12/e472f7a0-2a31-4077-8d93-399079fb44b1.html
这样可以,VC6.0下调试通过,讲WinIo.dll、WinIo.sys、WinIo.vxd(Win9x中用,Win2000以上可以不要)、WinIo.lib、WinIo.h放到工程文件夹下
C/C++ code
#include "windows.h"
#include "winio.h"
#include
#pragma comment(lib, "WinIo.lib")
int main(void)
{
bool bResult=0;
unsigned long data=0;
DWORD compare = 0x80000000;
//Call InitializeWinIo to initialize the WinIo library.
bResult = InitializeWinIo();
if (bResult)
{
for(int i = 0; i < 128; ++i)
{
compare = 0x80000000;
SetPortVal(0x70, i, 1);
Sleep(1);
GetPortVal(0x71, &data, 1);
printf("端口:%3d 数值:%4d 二进制数值:",i,data);
for(; compare != 0; compare >>= 1)
printf("%u", ((compare&data) == compare));
printf("\n");
data = 0;
}
ShutdownWinIo();
}
else
{
printf("Error during initialization of WinIo.\n");
exit(1);
}
return 0;
}
|
|