Modbus RTU - PLC as a slave

marcin.w
2018-08-21
2021-07-15
  • marcin.w - 2018-08-21

    Hi,
    I'm using Eaton PLC XC303 and I'm trying to make PLC as a Modbus slave.
    And there is a problem, I can't use holding registers to read and write them.
    I can't write values to the registers from PLC side. Why?

     
  • johnlee - 2018-08-21

    Hi marcin.w,

    if the PLC are using codesys V3, just make sure you have configure the device properly and make sure you have add the IO channel correctly.

    if you use holding register just make sure you have add the IO channel for FC 03(reading) FC06 or FC16(for write)

    Thank you
    John Lee

     
  • marcin.w - 2018-08-21

    You don't understand me. PLC is a slave, not master, so there is no any channel settings.
    And yes, PLC is on Codesys v3.

     
  • Anonymous - 2018-08-21

    Originally created by: ph0010421

    Does your device have the Modbus slave licence? My preferred Codesys plc has a Modbus master, but will not act as a slave due to not having the licence.
    Some genius has probably written a Modbus slave library

     
  • johnlee - 2018-08-22

    Hi marcin.w,

    As normal standard Codesys V3 soft PLC, regardless your modbus master or slave, you have to do the configuration.

    The step for configure as slave is adding the device->add modbus slave->add modbus serial device.

    Then inside the modbus serial device have the memory where is for outside using reading holding register to read or write.

    as for some other brand PLC like ABB, Wago , where default have open up the modbus slave function where will automatically to map all the PLC internal memory for all the modbus function.

    this is example for standard codesys V3 softPLC modbus setup

    Thank you
    Lee Junn Hei

    IMG: ModbusExample.PNG

     
  • marcin.w - 2018-08-23

    ph0010421 hat geschrieben:
    Does your device have the Modbus slave licence? My preferred Codesys plc has a Modbus master, but will not act as a slave due to not having the licence.
    Some genius has probably written a Modbus slave library

    Eaton Codesys doesn't need another license for Modbus slave

    johnlee hat geschrieben:
    Hi marcin.w,
    As normal standard Codesys V3 soft PLC, regardless your modbus master or slave, you have to do the configuration.
    The step for configure as slave is adding the device->add modbus slave->add modbus serial device.
    Then inside the modbus serial device have the memory where is for outside using reading holding register to read or write.
    as for some other brand PLC like ABB, Wago , where default have open up the modbus slave function where will automatically to map all the PLC internal memory for all the modbus function.
    this is example for standard codesys V3 softPLC modbus setup
    Thank you
    Lee Junn Hei

    Yes, I know these all things.
    P.S.
    I've got answer from Eaton support, that the problem is with the Eaton Codesys.
    So probably they will fix it in the next version.

    Thank you guys for help. For now that's all. Bye

     
  • greg-ch - 2021-07-14

    As see, in codesys the holding registers are only for writing and the input register just for reading. I don't know for where they take this rule, onde holding register can be read or write in modbus...

    I have another problem tha I think will be usefull to share here. My master was reading only zeros from codesys. No erros, but the registers were always at zero... So I changed the option "aways uptade variables" (see the attachment) to "enabled". Worked for me.

     
    • i-campbell

      i-campbell - 2021-07-15

      There is a checkbox for writeable holding registers, see attached screenshot.

       
      πŸ‘
      1
    • i-campbell

      i-campbell - 2021-07-15

      I heartily welcome you to the club of people who have learned that by default, IO not used in the code is never updated.

       
      πŸ‘
      1
  • greg-ch - 2021-07-15

    I don't have this option... either on modbus serial or TCP. I'm using codesys 3.5.11.0

     

Log in to post a comment.