简体   繁体   English

C#LPT回送测试

[英]c# LPT loopbacktest

I need to test LPT Ports via a Loopbacktest. 我需要通过Loopbacktest测试LPT端口。 I've got Loopbackdongles and just want to know if the LPT Ports are working correctly. 我有Loopbackdongles,只想知道LPT端口是否正常工作。 I have no idea how to accomplish this goal with c#. 我不知道如何使用C#实现此目标。 I know that I need these inpout.dll's for either 32- or 64-bit. 我知道我需要这些inpout.dll用于32位或64位。 But how can I use this for a loopback? 但是,如何使用它进行环回?

Thanks in advance. 提前致谢。

Parallel ports went the way of the dodo fifteen years ago. 十五年前,平行港口就成为了渡渡鸟。 Back in the stone age, they were used for printers, the Centronics interface was standard. 在石器时代,它们被用于打印机,Centronics接口是标准配置。 The standard parallel port back then looked like this schematically: 然后,标准并行端口示意图如下:

在此处输入图片说明

Note that it had 8 bits for Data Out but no bits reserved for Data In. 请注意,它有8位用于数据输出,但没有为数据输入保留位。 Printers didn't talk back, other than a few handshake and status signals (ACK, Error, Selected, Out of paper, Busy). 打印机没有回音,除了一些握手和状态信号(ACK,错误,已选择,缺纸,繁忙)。

That wasn't very useful for general purpose I/O so after a while the interface was improved. 这对于通用I / O并不是很有用,因此一段时间后接口得到了改进。 Rather poorly unfortunately, there was no single industry standard. 不幸的是,没有统一的行业标准。 There was at least EPP (Enhanced Parallel Port) and ECP (Extended Capabilities Port), neither became dominant. 至少有EPP(增强型并行端口)和ECP(扩展功能端口),都没有成为主导。 Ports used in industrial applications just used their own vendor specific schemes, mutually incompatible. 工业应用中使用的端口仅使用其自己的特定于供应商的方案,彼此不兼容。 That completely killed the idea, USB put the final nail in the coffin. USB完全钉住了棺材,这彻底打消了这个主意。

Accordingly, there never was a common standard in software either. 因此,软件中也从来没有一个通用的标准。 MS-Dos just supported the LPT device for printers, Windows' Parallel driver only supports interfacing to a printer and just implements the STROBE/ACK handshake with only support for output. MS-Dos仅支持打印机的LPT设备,Windows的Parallel驱动程序仅支持与打印机的接口,并且仅实现STROBE / ACK握手,仅支持输出。

So the first thing you need is a driver that supports your parallel port. 因此,您需要的第一件事是支持并行端口的驱动程序 Not uncommonly that's inpout32.dll, a very simple driver that gives a user mode program direct access to the I/O ports. 并不罕见的是inpout32.dll,这是一个非常简单的驱动程序,可让用户模式程序直接访问I / O端口。 In which case you also need to know at which address the port is mapped and what registers it uses. 在这种情况下,您还需要知道端口映射到的地址以及使用的寄存器。 Contact the vendor of the device you use if you don't know. 如果您不知道,请与您使用的设备的供应商联系。

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

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