visual c ++并行端口控制

时间:2013-03-03 05:30:49

标签: c++ parallel-processing port

我在Visual c ++中编写了这段代码,通过并行端口来控制LED:

// InpoutTest.cpp:定义控制台应用程序的入口点。 //

 #include "stdafx.h"
 #include "stdio.h"
 #include "string.h"
 #include "stdlib.h"
 #include <conio.h>

 short _stdcall Inp32(short PortAddress);
 void _stdcall Out32(short PortAddress, short data);


 int main(int argc, char* argv[])
 {
     Out32(888, 255);
     system("pause");
         Out32(888, 0);

     return 0;
 }

现在,我想的是'Out32(888,255);'将在所有数据寄存器中写入1,从D0到D7连接的所有LED将打开;但没有发生任何事情,在执行之前处于领先地位的领导人仍在继续,并且领导的那些已经关闭了。

与'Out32(888,0);'的情况相同,没有关闭led。

上面的代码有什么问题?我使用'Inpoutx64.dll',因为我正在使用64位操作系统(Windows 8)。我还在项目属性中包含了“Inpoutx64.lib”&gt;链接&gt;输入&gt;其他依赖项。

我还将“inpoutx64.dll”复制到Windows / system 32

1 个答案:

答案 0 :(得分:1)

确保您在生成的inpoutx64.dll文件所在的目录中有.exe,并且您已运行InstallDriver.exe附带的inpoutx64.dll程序,并允许UAC提升,以便安装所需的系统驱动程序。