From 06e1934ead2f1b81718533bf5d55de42e05e090d Mon Sep 17 00:00:00 2001 From: dhoomakethu Date: Thu, 26 Oct 2017 09:51:50 +0530 Subject: [PATCH] #190 fix asynchronous processor example --- examples/common/asynchronous-processor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/common/asynchronous-processor.py b/examples/common/asynchronous-processor.py index b5d3f8f48..e903610de 100755 --- a/examples/common/asynchronous-processor.py +++ b/examples/common/asynchronous-processor.py @@ -19,8 +19,8 @@ #---------------------------------------------------------------------------# #from pymodbus.transaction import ModbusBinaryFramer as ModbusFramer #from pymodbus.transaction import ModbusAsciiFramer as ModbusFramer -#from pymodbus.transaction import ModbusRtuFramer as ModbusFramer -from pymodbus.transaction import ModbusSocketFramer as ModbusFramer +from pymodbus.transaction import ModbusRtuFramer as ModbusFramer +# from pymodbus.transaction import ModbusSocketFramer as ModbusFramer #---------------------------------------------------------------------------# # configure the client logging @@ -33,7 +33,7 @@ #---------------------------------------------------------------------------# # state a few constants #---------------------------------------------------------------------------# -SERIAL_PORT = "/dev/ttyS0" +SERIAL_PORT = "/dev/ttyp0" STATUS_REGS = (1, 2) STATUS_COILS = (1, 3) CLIENT_DELAY = 1 @@ -62,7 +62,7 @@ def fetch_holding_registers(self): ''' Defer fetching holding registers ''' log.debug("Starting the next cycle") - d = self.read_holding_registers(*STATUS_REGS) + d = self.read_holding_registers(*STATUS_REGS, unit=1) d.addCallbacks(self.send_holding_registers, self.error_handler) def send_holding_registers(self, response): @@ -72,7 +72,7 @@ def send_holding_registers(self, response): ''' self.endpoint.write(response.getRegister(0)) self.endpoint.write(response.getRegister(1)) - d = self.read_coils(*STATUS_COILS) + d = self.read_coils(*STATUS_COILS, unit=1) d.addCallbacks(self.start_next_cycle, self.error_handler) def start_next_cycle(self, response):