HMI Pad Forums Old forum Support (old) Modbus: Reading and writing on different addresses

This topic contains 1 reply, has 1 voice, and was last updated by  jojanssen 8 years, 9 months ago. This post has been viewed 1308 times

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #19939


      Dear team,
      I try to integrate our Dupline bus system. Reading boolean values is ok, as well as reading integer values.
      But when trying to set a boolean value, an error message occurs (“An error was found in received data”).
      The reason most likely lies in the fact that e.g. the address to write is HR4001 (Bit 6), while the corresponding address to read is HR4 (Bit 6). The PLC does not allow to read from the address to write to (and the function codes differ naturally).
      Is there a way to solve this?

      Equipment: iPad 2, Moxa Serial Device Server N5150



        ScadaMobile (or Modbus Gem) use modbus function 22 (write mask register) to set individual bits of a modbus register to prevent altering the remaining ones. Not all PLC, and specially small RTUs do support this command.

        For reading, the app uses register read functions that are supported by all modbus devices. Individual bits are then extracted form the registers.

        For writes, if your PLC does not support modbus function 22, then individual writes of Bits on HR registers may not be possible with the SM app. You can alternatively use Coils for this purpose.

        Either with coils or registers there is a way to write a register without ever being read. You must have a hidden row for that register (so that it is never read), and then you set values to it using a ‘value’ expression. For example

        read_only_bit, BOOL, HR4.6, “label=”"read only”"; ”
        write_only_bit, BOOL, HR4001.6, “label=”"write only”"; hidden=1; value = the_bit;”
        the_bit, BOOL, INTERNAL, “write_access=9; ”

        - First row will read and display HR4.6 in the usual way,
        - Second row is hidden and will write HR4001.6 depending on the state of ‘the_bit’. This assumes that function 22 is supported on your PLC
        - Third row creates a switch control for ‘the_bit’

        If function 22 is not supported on your PLC, then you can replace the second row by this

        write_only_register, INT, HR4001, “label=”"write only”"; hidden=1; value = the_bit*64;”

        However, beware that using this may lead to inconsistencies if you are using other bits on the same register.

        HOWEVER: The error you get: “An error was found in received data” implies an incorrect Modbus frame being received from the PLC. This triggers a network disconnection on the ScadaMobile side. All modbus slaves are supposed to return a well formed modbus error frame when they do not understand a command or when they are unable to execute a command. This means that all being OK, this error should never appear and therefore it almost surely implies some sort of bug at one side of the communicating devices (either the SM app or the RTU device). I am sending you a private message to discuss how we can look at this.

        SweetWilliam Support.

      Viewing 2 posts - 1 through 2 (of 2 total)

      You must be logged in to reply to this topic.

      Copyright © SweetWilliam, S.L 2009-2013. All rights reserved.
      Science and Technology Park of the University of Girona, Emili Grahit, 91 (NarcĂ­s Monturiol building, Office P3-B03) 17003-Girona. Phone +34972183244