本文介绍了使用并行有线 RS232 从多个设备接收数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个小型应用程序,用于监控太阳能收集器产生的功率/电流.

I'm currently developing a small application for monitoring the power / current our solar collector is generating.

阵列连接到 3 个逆变器.每台逆变器都有一个RS232接口,每10秒传输一条信息(当前状态).

The array is connected to 3 inverters. Every inverter has a RS232 interface, transmitting one Line of information(its current status) every 10 seconds.

由于我想使用只有一个串行端口的设备进行监控,因此我需要想出一种方法来并行读取所有逆变器的数据.我不需要向其中一台逆变器发送任何东西!

Since I want to do the monitoring using a device only having one serial port, I need to come up with a way to be able to read the data from all of the inverters in parallel.I don't need to send anything to one of the inverters!

是否可以只将 3 条 RS232 线并联连接到一个串行端口?由于每个逆变器仅传输以换行符结尾的 64 字节/10 秒,因此不太可能发生冲突,因此我可以检查可变行长度以检测冲突.

Is it possible to just connect 3 RS232 wires in parallel to one serial port? Collisions will be pretty unlikely since every inverter is transmitting only 64Byte / 10seconds ending with a newline, so I could check for variable line lengths to detect collisions.

推荐答案

,您不应该并联 3 个串行输出端口.如果这样做,您可能会破坏逆变器的 RS232 输出电路.

No, you should NOT connect 3 serial output port in parallel. If you do that you are probably going to broke the RS232 output circuitry of your inverters.

你有 3 个 RS232 输出,所以你需要 3 个 RS232 输入,那么你可以按照你喜欢的方式管理这 3 个输入:也许你可以缓冲每个输入的数据,然后在单个 RS232 输出上重新输出数据,以便连接到您的监控设备......但您应该在数据流中添加一些代码以区分来自 3 个逆变器的数据.

You have 3 RS232 outputs, so you need 3 RS232 input, then you can manage these 3 input the way you like: maybe you can buffer the data from each input, and reoutput the data on a single RS232 output, to be connected to your monitoring device.... but you should add some code in the data flow to differentiate the data coming from the 3 inverters.

也许您可以使用某种 IC 来为您完成这项工作,我不确定,但也许某些在单个 RS232 输出上多路复用多个 RS232 输入的 IC 已经存在.试试这个搜索:Google 上的 rs232 端口输入多路复用器

Maybe you can use some kind of IC that do the job for you, I'm not sure, but maybe that some IC that multiplex multiple RS232 input on a single RS232 output already exist.Try this search: rs232 port input multiplexer on Google

或者,如果监控设备是 Window 计算机,您可以使用 3 个串口转 USB 转换器:这将在您的计算机上创建 3 个虚拟 COM 端口,您可以使用任何软件从中读取数据.

Or, if the monitoring device is a Window computer, you can use 3 serial-to-usb converter: that will create 3 virtual COM port on your computer and you can read data from them with any software.

更新
关于使用二极管保护输出电路以阻止重新进入电流的假设,我认为它不会起作用...
自从上次我在低级别使用 RS232 链接(所以也许我错了)以来已经过去了很多年,但我认为 RS232 输入和输出端口之间存在某种握手(使用速度,奇偶校验, 停止位...).
每个 RS232 端口都有输入和输出信号,用于数据和传输控制,因此您的多个 RS232 输出确实有一些输入信号,而您的单个 RS232 输入确实有一些输出.
这意味着您的输入监控 RS323 端口将尝试同时与 3 个 RS323 端口握手......而 3 个 RS232 端口可能会同时响应......所以我认为它不会去工作.

Update
About the hypothesis of securing the output circuitry using diods to block reentering current, I don't think it's going to work...
Many year have passed by since last time I've used an RS232 link at low level (so maybe I'm wrong) but I think that there is some kind of handshake going on between RS232 input and output port (speed to use, parity, stop bit...).
Each RS232 port have inputs and outputs signal, both for data and for transmission control, so your multiple RS232 outputs does have some input signals, and your single RS232 input does have some outputs.
This mean that your input monitoring RS323 port is going to try to make a handshake with 3 RS323 ports at the same time... and the 3 RS232 ports are probably going to respond at the same time... so I think it's not going to work.

除此之外,如果你在输出端放置二极管,你会失去 0.7v,我不记得 RS232 信号电平的容差,但也许 0.7v 可能是相关的.

Other than that if you place diodes on your output, you are going to loose 0.7v, I don't remember the tolerance on signal level of RS232, but maybe that 0.7v can be relevant.

这篇关于使用并行有线 RS232 从多个设备接收数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 16:02