'How can i communicate between delta plc with Ethernet support and python pymodbustcp

please help me My first test is with a Delta DVP-12SE11R PLC and the connection is with the Modbus TCP/IP protocol. I have a python code written using pymodbustcp module. I have tested that code with a modbus slave simulator and it is working properly. Reading and writing required registers on simulator. My question is when i connect a plc hardware to PC and provide ip address of plc and port number to python code and it will start reading and writing the registers i specified in code or am i missing somethings that are required for communication?

This is what i am using:

from pyModbusTCP.client import ModbusClient
c=ModbusClient(host='localhost',port=9999,auto_open=True)

regs=c.read_holding_registers(403705,1)
print("reading register values")


if regs:
    print(regs)
else:
    print("error")

print("write value to register")
a=int(input())
c.write_single_register(403705,a)

I did check using a python link tcp simulator and it works perfactly with the simulator.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source