• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Modbus: Reset value at Communication Error

    Mervis
    2
    3
    598
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      DickesC last edited by

      Hi

      I am reading some values from a modbus power meter (e.g. active power in watts)

      Everything fine so far.

      But i have a little problem:

      If the power of the power meter fails, mervis gets a communication error.
      The PLC value stays at the last value read from the power meter.

      How can i "reset" this value to "0" if there is a communication error?

      Thanks

      Martin Kudláček 1 Reply Last reply Reply Quote 0
      • Martin Kudláček
        Martin Kudláček administrators @DickesC last edited by

        Hi @dickesc,
        simply - you cannot. But I think you are trying to somehow get the information about the failed communication, is that correct?

        If so, each Modbus group of elements has so called "attributes", which are special variables, which for example tell you when the last communication occured, and what is the last state of the communication exchange:

        0_1563460736405_6a8e4e53-2944-49f0-9c3e-545fe6350972-image.png

        What you are probably looking for is the _commerror variable. When true, the current value in all the elements is not correct, since the communication is broken. If false, the values are correct.

        Include this _commerror variables into your program to detect and work around the communication errors.

        Best regards,
        Martin

        1 Reply Last reply Reply Quote 0
        • D
          DickesC last edited by

          Hi

          Thanks, works perfectly!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post