我们如何使用Spark Streaming使用MODBUS协议从所有65536个寄存器中读取数据?

时间:2022-02-17 20:51:20

I have a specific condition where I want to read data from MODBUS protocol.

我有一个特定的条件,我想从MODBUS协议读取数据。

But it only allows me to read 120 registers at once.If I increase this count it gives me ERROR CODE=3 I am using JAMOD for this.

但它只允许我一次读取120个寄存器。如果我增加这个数,它会给我ERROR CODE = 3我正在使用JAMOD。

Is there a way in which I can read data from all the registers ?

有没有办法可以从所有寄存器中读取数据?

I've already gone through these links , but they are not helpful:

我已经浏览过这些链接,但它们没有帮助:

  1. How to resolve ModbusSlaveException: Error Code = 3?

    如何解决ModbusSlaveException:错误代码= 3?

  2. http://control.com/thread/1026161502#1026161502

I've made a Custom Spark Receiver for reading data and I need to push this data inside Kafka.

我已经制作了一个用于读取数据的Custom Spark Receiver,我需要在Kafka中推送这些数据。

Please provide me a solution or a way around for this in which I can read all 65536 registers.

请给我一个解决方案或解决方法,我可以读取所有65536个寄存器。

1 个解决方案

#1


0  

In Field Contents in Modbus Messages in the Modicon Modbus Protocol Reference Guide PI–MBUS–300 Rev. J, the Byte Count field in the response messages determines the number of 8-bit bytes of content returned. Since registers are 16 bits long, and the field is 8-bits long, no more than 128 can possibly be returned. This is further restricted by including some of the other fields in the message in the Byte Count length.

在Modicon Modbus协议参考指南PI-MBUS-300 Rev. J中的Modbus消息的字段内容中,响应消息中的字节计数字段确定返回的8位字节内容的数量。由于寄存器是16位长,并且字段长度为8位,因此可能返回不超过128位。通过在字节计数长度中包括消息中的一些其他字段来进一步限制这一点。

Do not expect to receive more than about 125 registers in each request. Multiple requests are required to retrieve the entire address space.

不要期望在每个请求中接收超过125个寄存器。检索整个地址空间需要多个请求。

Note that some devices may return errors when a request to read undefined registers is sent to them. Unless a complete memory map is available, only registers specifically documented should be read.

请注意,当向其发送读取未定义寄存器的请求时,某些设备可能会返回错误。除非有完整的存储器映射,否则只应读取具体记录的寄存器。

#1


0  

In Field Contents in Modbus Messages in the Modicon Modbus Protocol Reference Guide PI–MBUS–300 Rev. J, the Byte Count field in the response messages determines the number of 8-bit bytes of content returned. Since registers are 16 bits long, and the field is 8-bits long, no more than 128 can possibly be returned. This is further restricted by including some of the other fields in the message in the Byte Count length.

在Modicon Modbus协议参考指南PI-MBUS-300 Rev. J中的Modbus消息的字段内容中,响应消息中的字节计数字段确定返回的8位字节内容的数量。由于寄存器是16位长,并且字段长度为8位,因此可能返回不超过128位。通过在字节计数长度中包括消息中的一些其他字段来进一步限制这一点。

Do not expect to receive more than about 125 registers in each request. Multiple requests are required to retrieve the entire address space.

不要期望在每个请求中接收超过125个寄存器。检索整个地址空间需要多个请求。

Note that some devices may return errors when a request to read undefined registers is sent to them. Unless a complete memory map is available, only registers specifically documented should be read.

请注意,当向其发送读取未定义寄存器的请求时,某些设备可能会返回错误。除非有完整的存储器映射,否则只应读取具体记录的寄存器。