在现代硬件和操作系统上通过 USB 适配器控制并行端口 [英] Controlling a parallel port via USB adaptor on modern hardware and OS

查看:29
本文介绍了在现代硬件和操作系统上通过 USB 适配器控制并行端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 USB 转并口设备,我想在现代 Windows 操作系统(xp 和更新版本)上通过 C++ 连接它.

I have a USB to parallel port device that i want to interface with through c++ on a modern windows OS (xp and newer).

我做了一些研究,但是当涉及到对这些 USB 转并口设备之一进行编程时,信息有点不完整(大部分信息都是过时的,并假设您在主板,我的全新电脑没有的东西).一个参考文献甚至说,如果不进行某种软件更改,就不可能将 C++ 程序的 USB 接口连接到并行端口.

I've done a little research but the information is a bit patchy when it comes to programming to one of these USB to parallel port devices (most of the information is dated and assumes that you have a parallel port built right into the motherboard, something my brand new computer doesn't have). One reference even says that it is not possible to interface with a USB to parallel port from a C++ program without some sort of software changes.

我想要做的就是能够在运行现代 Windows 操作系统的现代计算机上通过 USB 到并行端口设备读取或写入 8 位到并行端口(端口专用于读取或写入).

All i want to do is to is be able to read or write 8 bits to the parallel port through a USB to parallel port device on a modern computer running a modern windows OS (with ports being dedicated to reading or writing only).

有什么快速简便的方法吗?一些示例代码将不胜感激.

Is there any quick and easy way of doing this? Some sample code would be greatly appreciated.

此外,这些 USB 转并口中有多少个可以与我的计算机连接?由于某种传统寻址,我是否仅限于 3 个,或者我可以拥有尽可能多的 USB 和 CPU 支持?

Also, how many of these USB to parallel ports can I interface with my computer? Am i limited to 3 due to some sort of legacy addressing or can i have as many as my USB and CPU are able to support?

使用 VC++ 2008,运行带有 Core i7 860 的 Windows 7 x64.

Working off VC++ 2008, running Windows 7 x64 with a Core i7 860.

更多信息...

我尝试将 inpout23 与一些预先编写的测试程序一起使用.它编译得很好并且运行得很好,声称对并行端口进行了读取和写入.我将 USB 转并行端口连接到计算机,并将该端口连接到一根电缆,我已经在其中识别、剥离并焊接了 25 根电线中的每一根到一种插头上,以便快速插入面包板进行测试.没有任何输出引脚更改为程序所说的写入它们的内容(相反,它们都设置为高电平且从未更改).

I've tried using inpout23 along with some prewritten test program. It compiled just fine and ran just fine claiming to have both read and written to a parallel port. I had my USB to parallel port connected to the computer and that port connected to a cable in which i had identified, stripped and soldered each of the 25 wires onto a sort of plug for quickly plugging into a breadboard for testing. None of the output pins had changed to what the program had said was written to them (instead they were all set to high and never changed).

推荐答案

我过去做过这个,有好消息也有坏消息.

I've done this in the past and I have good news and bad news.

好消息是它总是有效(有时需要调整),这是对设计极其强大协议的电子制造商的致敬.显然USB转并行转换器都提供了硬件端口仿真.

The good news is that it always worked (sometimes with tweaking), which is a tribute to the electronic manufacturers of designing extremely robust protocols. Apparently the USB to parallel converters all provided the hardware port emulation.

坏消息是bitbanging"界面模型的性能很糟糕.如果您不介意缓慢的更新,这根本不是问题.我用它来对 uController 进行编程,很快就因为我的不耐烦而克服了串行或 USB 编程器的价格.

The bad news is that performance was awful on the 'bitbanging' interface models. If you do not mind slow updates this is not an issue at all. I used it for programming uControllers and soon the price of serial or USB programmers was overcome by my impatience.

只需使用 windows API 来读/写 LPT 或 COM 端口,它就可以工作(很慢).

Just use the windows API to read/write the LPT or COM ports and it works (slowly).

这篇关于在现代硬件和操作系统上通过 USB 适配器控制并行端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆