如何检查RS232电缆断开? [英] How to check RS232 cable disconnected ?

查看:94
本文介绍了如何检查RS232电缆断开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通用测试机器的RS232串口,并想知道是否有方法,功能或方法来确定串口连接是否被禁用,有人断开电缆或断线。



我尝试了什么:



我尝试使用Data_Received, ErrorReceived。

I am using RS232 serial port for Universal Testing machine and will like to know if there is a method, function or a way to find out if a serial connection has been disabled, either by someone disconnecting the cable or a broken wire.

What I have tried:

I tried it with Data_Received, ErrorReceived.

推荐答案

除了使用专用控制线或硬件支持的检测之外,没有可靠的方法来检测有缺陷或未插入的电缆(通常在测量的串行驱动器IC中实现)电压水平)。



当通信使用硬件流控制时,检测已经存在。只需检查所用控制线的状态。



当不使用硬件握手并访问设备时,可以设置DSR,CTS或DCD线之一到定义的级别(硬连线或软件控制),PC软件可以检查相应线路的状态。硬连线意味着驱动相应输出线的驱动器IC的输入。这将检测未连接且未供电的设备。当相同的输入由微控制器驱动时,它也可以用于检测设备是否正忙。



当不使用硬件握手且无法访问时对于设备内部,可以通过循环控制信号来实现检测。例如,连接设备插头上的CTS和RTS引脚。然后PC可以设置RTS输出并检查CTS输入。这将检测是否已插入电缆并且特定设备已连接但不会检测设备是否已断电。



不使用上述方法之一时您所能做的就是处理超时条件(设备没有响应),这也取决于使用的通信协议。
There is no reliable method to detect defective or unplugged cables besides using dedicated control lines or hardware supported detection (usually implemented in the serial driver IC that measures the voltage levels).

When the communication uses hardware flow control the detection is already there. Just check the state of the used control lines.

When not using hardware handshake and having access to the device, that can set one of the DSR, CTS or DCD line to a defined level (hard wired or under software control) and the PC software can check the state of the corresponding line. Hard wired means driving the input of the driver IC for the corresponding output line. This will detect not connected and not powered devices. When the same input is driven by a micro controller it can be for example also used to detect that the device is busy.

When not using hardware handshake and having no access to the device internals, the detection can be implemented by looping control signals. For example connect the CTS and RTS pins on the plug of the device. Then the PC can set the RTS output and check the CTS input. This will detect if a cable is plugged in and the specific device is connected but will not detect if the device is powered off.

When not using one of the above methods all you can do is handling timeout conditions (no response from device) which depends also on the used communication protocol.


这篇关于如何检查RS232电缆断开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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