Skip to content
This repository was archived by the owner on Jul 24, 2022. It is now read-only.
This repository was archived by the owner on Jul 24, 2022. It is now read-only.

Modbus RTU - ReadHoldingRegisters don't read after 10 seconds #183

Description

@stefurios

I have a problem use this library with Modbus RTU.
I would like to read the data cyclically after a certain period of time (30 seconds), I have problems if I put the time interval greater than or equal to 10 seconds while I have no problems if this is less.
In particular I am using the ReadHoldingRegisters and at the second cycle the application gets stuck on the read and I have a substantial increase cpu use. I tried to set all the client properties (ReadTimeout, Retries ...) but the problem persist.
I have not experienced the same problem with Modbus TCP.
Here is a simple example showing the problem.

`
tcpClient = new TcpClient(hostname, port);
modbusClient = ModbusSerialMaster.CreateRtu(tcpClient);
modbusClient.Transport.ReadTimeout = 1000;
modbusClient.Transport.WriteTimeout = 1000;

        while (true)
        {
            ushort[] result = modbusClient.ReadHoldingRegisters(slaveAddress, address, numRegister);
            foreach (var item in result)
            {
                Console.WriteLine(item);
            }
            Thread.Sleep(10000);
        }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions