简体   繁体   English

visual c ++并行端口控制

[英]visual c++ parallel port control

I wrote this code in Visual c++ to control LED's through parallel port: 我在Visual c ++中编写了这段代码来通过并行端口来控制LED:

// InpoutTest.cpp : Defines the entry point for the console application. // 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;
 }

Now, what I thought was that the line 'Out32(888, 255);' 现在,我想的是'Out32(888,255);' will write 1 in all data registers, and all LED'd connected from D0 to D7 will turn on; 将在所有数据寄存器中写入1,从D0到D7连接的所有LED将打开; but nothing happened, the led's which were on before execution remained on and same case with the led's which were off. 但是没有任何事情发生,在执行之前处于领先地位的领导者仍在继续,并且领导的那些已经关闭。

Same was the case with 'Out32(888, 0);', no led's were turned off. 与'Out32(888,0);'的情况相同,没有关闭led。

What is wrong in the above code? 上面的代码有什么问题? I used 'Inpoutx64.dll' as I'm working on 64 bit OS (windows 8). 我使用'Inpoutx64.dll',因为我正在使用64位操作系统(Windows 8)。 I also included 'Inpoutx64.lib' in project properties > linked > input > Additional dependencies. 我还在项目属性> linked> input> Additional dependencies中包含了“Inpoutx64.lib”。

I've also copied "inpoutx64.dll' to Windows/system 32 我还将“inpoutx64.dll”复制到了Windows / system 32

确保将inpoutx64.dll与生成的.exe文件放在同一目录中,并且已运行inpoutx64.dll包含的InstallDriver.exe程序,并允许UAC提升,以便安装所需的系统驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM