Temco PLC as Modbus Master

Hi @chelsea, thanks for the answer, I succeeded.

Unfortunately, you did not answer my question about pauses in Modbus requests. I see that polling by the controller is unstable and this is bad. You probably don’t suspect this, because usually Modbus Slave devices do not display read errors. I see these errors in the emulator program, see video: https://youtu.be/H3B0p6gX5Pw
I don’t see your code in which the controller generates a request, but I believe that in the controller’s request the pauses equal to 3.5 characters required by the Modbus standard are not met.
See below for an example of Python code in which these pauses are implemented:

    # Sleep to make sure 3.5 character times have passed
    minimum_silent_period = _calculate_minimum_silent_period(self.serial.baudrate)
    time_since_read = _now() - _latest_read_times.get(self.serial.port, 0)

    if time_since_read < minimum_silent_period:
        sleep_time = minimum_silent_period - time_since_read

        if self.debug:
            template = (
                "Sleeping {:.2f} ms before sending. "
                + "Minimum silent period: {:.2f} ms, time since read: {:.2f} ms."
            )
            text = template.format(
                sleep_time * _SECONDS_TO_MILLISECONDS,
                minimum_silent_period * _SECONDS_TO_MILLISECONDS,
                time_since_read * _SECONDS_TO_MILLISECONDS,
            )
            self._print_debug(text)

        time.sleep(sleep_time)


    def _calculate_minimum_silent_period(baudrate):
        """Calculate the silent period length between messages.
        It should correspond to the time to send 3.5 characters.
        Args:
            baudrate (numerical): The baudrate for the serial port
        Returns:
            The number of seconds (float) that should pass between each message on the bus.
        Raises:
            ValueError, TypeError.
        """
        # Avoid division by zero
        _check_numerical(baudrate, minvalue=1, description="baudrate")

        BITTIMES_PER_CHARACTERTIME = 11
        MINIMUM_SILENT_CHARACTERTIMES = 3.5
        MINIMUM_SILENT_TIME_SECONDS = 0.00175  # See Modbus standard

        bittime = 1 / float(baudrate)
        return max(
            bittime * BITTIMES_PER_CHARACTERTIME * MINIMUM_SILENT_CHARACTERTIMES,
            MINIMUM_SILENT_TIME_SECONDS,
        )

I await your reply!