案例: from modbus_tk import modbus_tcp,defines import time s = modbus_tcp.TcpServer(port=5300) def main(): try: s.start() s.add_slave(1) sl = s.get_slave(1) sl.add_block('block0',defines.HOLDING_REGISTERS,0,100) sl.set_values('block0',0,[1 for i in ran…