brainelectronics / micropython-modbus

MicroPython Modbus RTU Slave/Master and TCP Server/Slave library
GNU General Public License v3.0
104 stars 45 forks source link

Async slave for modbus RTU #88

Closed Omid888 closed 3 months ago

Omid888 commented 5 months ago

Description

As I have come to realize from the examples, implementing a slave modbus RTU is a blocking process through the ModbusRTU.process() function. This makes the microcontroller useless and very limited because there's no way to change the coils and holding register's values while slave is responsive to incoming requests. (while updating the variables, the slave becomes irresponsible). So my question is are there any solutions/workarounds for this purpose?

Thank you for your really great work.

P.S: I noticed that there are other issues & PRs going on about this subject. But I didn't came to a conclusion.

MicroPython version

v1.22.1

MicroPython board

Raspberry Pico

MicroPython Modbus version

MicroPython infos: (sysname='rp2', nodename='rp2', release='1.22.1', version='v1.22.1 on 2024-01-05 (GNU 13.2.0 MinSizeRel)', machine='Raspberry Pi Pico with RP2040')

Used micropthon-modbus version: 2.3.7