Modbus RTU Master - how to change slave address from program

Anonymous
2020-02-04
2020-02-10
  • Anonymous - 2020-02-04

    Originally created by: georgejaniszewski

    Hello,
    I need to be able to change the Slave Address of the Modbus Slave COM Port object from within the program at runtime.
    Usually the Slave address would be set as a fixed value in the General tab of the object, but I need to change it dynamically.
    Would you please advise how this can be done.
    Thank you.
    George Janiszewski.

     
  • e.kislov - 2020-02-04

    Hi.

    Enter name of your component (default: Modbus_Slave_COM_Port) in code editor and use '.' operator to see internal variables and methods.
    You can use property SlaveAddress:

    Modbus_Slave_COM_Port.SlaveAddress := <value>;</value>

    You should to call this code also after reboot of PLC because in this case PLC get again "fixed value from the General tab".

     
  • Anonymous - 2020-02-10

    Originally created by: georgejaniszewski

    Thank you e.kislov for your assistance.
    George.

     

Log in to post a comment.