Jump to content

Ofer

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Ofer

  1. some help from friends and this forum - here is the last version of the controller side first added the close every 3 minutes - did not do the trick but helped a bit so i keep it there init the card socket and port and set tcp keep, link lost and connection gave a stable read even when power or cable momentarily removed
  2. Im just a nube so it took me a while to figure it out. on the unitronix side assign a slave to one of the ports like this on the python side read data with something like this import modbus_tk import modbus_tk.defines as cst import modbus_tk.modbus as modbus import modbus_tk.modbus_tcp as modbus_tcp import logging logger = modbus_tk.utils.create_logger("console", level=logging.DEBUG) master = modbus_tcp.TcpMaster(host='172.21.2.183', port=20257, timeout_in_sec=5.0) master.open actual_bits = master.execute(slave=1, function_code=cst.READ_COILS, starting_address=1, quantity_of_x=2) print("actual_bits =", actual_bits) master.close remember the slave number! Hope this helps someone
  3. could anyone supply a full example of using modbus on the plc side AND on the pc side? I would prefer a python example but a .NET is good too.
×
×
  • Create New...