Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Changing Modbus server IP in runtime

kallileo
2019-10-09
2019-10-11
  • kallileo - 2019-10-09

    I have set up Modbus TCP Client in Codesys 3.5.12 to read/write to are remote IO and I want to be able to change the IP of a Modbus TCP server (slave) in Codesys if the IP of the remote IO changes.
    The change of the slave IP should be made through a HMI or WebVisu.

    Modbus TCP slave has a method called UpdateCommunicationSettings with IP and Port as parameters.
    It says that "Fails (return value !=0) if TCP connection is currently established. (-->Use Enable Property to connect/abort)".

    Where do I find this Enable property?

     
  • kallileo - 2019-10-10

    The problem is tha I can't see xEnable property in the inputs and outputs list of the FB at all.
    My Modbus TCP Slave name is IO_Board and I get an error when I type IO_Board.xEnable.

                ------ Build started: Application: Device.Application -------
                typify code ...
    

    [ERROR] FB_CoolingUnit: FAULTS_CHECKING Device: PLC Logic: Application: C0018: 'IO_Board.xEnable' is no valid assignment target
    [ERROR] FB_CoolingUnit: FAULTS_CHECKING Device: PLC Logic: Application: C0004: 'xEnable' is no component of 'MODBUSTCPSLAVE'
    Compile complete -- 2 errors, 0 warnings

     
  • kallileo - 2019-10-10

    So in order for the Enable property to be shown, the option "EnableDiagnosis for devices" in PLC Settings has to be activated.

     
  • i-campbell

    i-campbell - 2019-10-10

    Great! So is it all working now?

     
  • kallileo - 2019-10-11

    I-Campbell hat geschrieben:
    Great! So is it all working now?

    Yes.
    Thanks for the tips.

     

Log in to post a comment.