Shivansh
Shivansh

Reputation: 3544

How can we read data from all 65536 registers using MODBUS protocol using Spark Streaming?

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

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.

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?

  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.

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

Upvotes: 0

Views: 913

Answers (1)

Pekka
Pekka

Reputation: 3654

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.

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

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.

Upvotes: 1

Related Questions