如何从 C++ 设置和读取并行端口上的引脚?

2022-01-18 00:00:00 serial-port c++ device-driver

我正在帮助一位朋友完成最后一年的项目,他有一个我们想使用 C++ 程序打开和关闭的电路.

I am helping a friend to finish a final year project in which he has this circuit that we want to switch on and off using a C++ program.

我最初认为这很容易,但我未能实施此程序.主要问题是

I initially thought it would be easy, but I have failed to implement this program. The main problem is that

  • Windows XP 及更高版本不允许直接访问硬件,因此某些网站都在提示我需要写驱动或者找驱动.
  • 我还查看了一些在线项目,但它们似乎适用于 Windows XP,但不适用于 Windows 7.
  • 另外,大多数项目都是用我不熟悉的 VB 或 C# 编写的.
  • Windows XP and above don't allow direct access to hardware so some websites are suggesting that I need to write a driver or find a driver.
  • I have also looked at some projects online but they seem to work for Windows XP but fail to work for Windows 7.
  • Also, most projects were written in VB or C# which I am not familiar with.

问题:

  • 是否有适用于 Windows XP 和 Windows 7 的驱动程序,如果有,我如何在我的代码中使用它?(代码片段将不胜感激)
  • 是否有一种跨平台的方式来处理与并行端口的通信?

推荐答案

看看codeproject:这里、这里和这里.你会找到宝藏的.

Have a look at codeproject: here, here and here. You'll find treasures.

第一个链接适用于 Windows 7 - 32 位和 64 位.

The 1st link works for Windows 7 - both 32 bit and 64 bit.

相关文章