CodeSys 3.5 Displayed Values Concerns

jadchamas
2020-06-17
2020-06-19
  • i-campbell

    i-campbell - 2020-06-17

    Make a GVL that has
    VAR
    VRmsTimeDomain : REAL AT %IB0;
    VRmsTimeDomainState : BYTE AT %IB4;
    END_VAR

    You can get the correct %IB from the Offset (Relative) column of Screenshot 2.

     
  • jadchamas - 2020-06-18

    Hi,

    I created the variables in GVL as you told me, but I still don't get the values in Real (Screenshot 1), the values are always shown in bytes as in Screenshot 2.

    Could you please explain more how to solve this Offset probem ? why can't I see the real values of the vibration object defined in VSE151?
    Thanks so much.

     
  • ph0010421 - 2020-06-19

    Hello
    Try creating a UNION between:

    AsBytes: ARRAY[0..3] OF BYTE;
    AsReal: REAL;

    Map your incoming bytes to AsBytes[0], [1], [2] and [3] and the REAL value should appear in AsReal.
    You may need to change the order 0123 to 2301 in the mapping depending on the device.

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • jadchamas - 2020-06-19

    Hi aliazz,

    Thanks a lot for your help, I found the solution in the link you sent me, the 'Union sructure' in codesys.

    TYPE uRealBytes :
    UNION
    rValue : REAL; // Needs 4 Bytes in memory
    abValue: ARRAY [0..3] OF BYTE;
    END_UNION
    END_TYPE

    Special thanks to all of you guys for your help and concern, I really appreciate.

     

Log in to post a comment.