Showing results 1 to 6 of 6

Thread: Modbus_mapping: (2): Assigned variable and expression must have the same type

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    04.06.2020
    Posts
    10

    Default Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi, While compiling logic processor program, following error pops up for two variables. Please let me know what does this error mean and how to fix this.
    I am trying to map 61850 client variable in Zenon to Modbus Slave in Logic processor.

    On 61850 side these are the two variables:





  2. #2
    Join Date
    18.12.2017
    Posts
    44

    Default Re: Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi!

    I see one SINT and one UDINT.
    One variable is signed and use 8 bits while the other is unsigned and use 32 bits.

    What data types in modbus are they mapped to?

  3. #3
    Join Date
    04.06.2020
    Posts
    10

    Default Re: Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi,

    I used  INT  in holding register.




    BR,
    Deepak

  4. #4
    Join Date
    18.12.2017
    Posts
    44

    Default Re: Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi!

    Then you need to convert your variable.
    An Int is signed 16 bits.
    V110 := ANY_TO_INT ({MVDA_52UA!MVDA_52UACTRL/CBXCBR1/...});


  5. #5
    Join Date
    04.06.2020
    Posts
    10

    Default Re: Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi,

    The reason I choose data type as INT is that when a variable is created using 'Modbus Slave Request> declare variables' the available options are only INT and UINT.

     


    Regardless I changed the datatype to UDINT to match the datatype from IEC 61850 client. That solves the error also.
    Is this also an acceptable way or I will have to use ANY_TO_INT functionality to convert from INT datatype (since MODBUS Slave request creates only INT, UINT variables)?


  6. #6
    Join Date
    18.12.2017
    Posts
    44

    Default Re: Modbus_mapping: (2): Assigned variable and expression must have the same type

    Hi!

    I would recommend reading a quick Modbus intro for basic understanding of the protocol.
    It will make it easier to understand how it works and how to map your variables without extra work.
    https://en.wikipedia.org/wiki/Modbus

    As long as you get the offset right, you can (almost) drag and drop your variables to the Holding register.
    Attached Thumbnails Attached Thumbnails 2021-05-28 10_13_50-Logic - Modbus.png  

Similar Threads

  1. Replies: 0
    Last Post: 1st September 2015, 10:48
  2. Variable diagnosis - Screen Type
    By daujivar in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 17th September 2013, 14:05
  3. Add a variable type 'byte'
    By martijnvanspijk in forum Drivers
    Replies: 2
    Last Post: 28th May 2013, 11:00
  4. Assigned RCB was not found
    By sstoilov@gmail.com in forum zenon Energy Edition
    Replies: 6
    Last Post: 31st May 2012, 09:37
  5. variable type time didn't appear in zenon
    By johnny in forum Engineering Studio Logic & Logic Service (former zenon Logic Workbench & Runtime)
    Replies: 3
    Last Post: 16th January 2009, 12:11

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •