Trying to send values to the numeric display to keep track of cycle count.

I am trying to keep track of cycle count for my project on the HMI EA3-S3ML. I am unfamiliar with using holding registers. I tried to write the following.

 

int cycle_count;

 

cycle_count = modbusTCPServer.coilWrite(4);

 

 

I keep getting an error that the compiler does not understand the code called in this way . Any suggestions


  • RBPLC (Customer)

    Not sure which Modbus library you're trying to use, but it looks like you're trying to write to a coil and not a holding register.

  • LRJ (Customer)

    If you have a value stored in "cycle_count" you are trying to display in the HMI at 40005, you could use

     

    modbusTCPServer.holdingRegisterWrite(4,cycle_count);

  • FACTS_MikeSc (AutomationDirect)

    The function you are calling requires at least two parameters. A modbus address and the value. The optional parameter is unit id that defaults to 0 if one is not provided.

     

    See the modbus library for reference. https://www.arduino.cc/reference/en/libraries/arduinomodbus/

     

    That being said, a coil is used for booleans and such. It's either a 1 or a 0. For integer values you can use a holding register as mentioned before.

    Expand Post
    • Ok but I am not sure how that fixes the communication issue. I am assuming the hmi is not working.

       

      • FACTS_MikeSc (AutomationDirect)

        The topic you posted about is for the compile error you had with the code you posted above.

        You're communication issue with the HMI is on another topic.

      • FACTS_MikeSc (AutomationDirect)

        No problem. Most of the libraries you find for Arduino generally have a reference somewhere on the available functions and how to use them.

         

        Modbus protocol can be a little confusing to understand if you are unfamiliar with it.

         

         

         

         

        Expand Post
  • Now I am getting a P499:Recv.ErrCode0002 when I select the screens that have numeric displays or numeric entry.

    • FACTS_MikeSc (AutomationDirect)

      I'm not that familiar with c-more error codes but a look at the manual, seems like the c-more panel is telling there is a modbus illegal address issue.

       

      C-more error codes reference: https://cdn.automationdirect.com/static/manuals/ea3userm/appxa.pdf

      P499: C-more reporting a modbus error

      0x0002: universal modbus exception error code for 'illegal address'

       

      I would check the tag(s) on the c-more panel are setup correctly that match with what you have setup on the p1am-100.

      Expand Post
10 of 41