Skip to content

Commit

Permalink
#190 fix asynchronous processor example
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoomakethu committed Dec 21, 2017
1 parent 00fb7dd commit 06e1934
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/common/asynchronous-processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 06e1934

Please sign in to comment.