rijow55814

MrPLC Member
  • Content count

    1
  • Joined

  • Last visited

Posts posted by rijow55814


  1. On 7/2/2021 at 2:27 PM, RikiWatasuta said:

    Hello all. First time post in this forum.

    I am hoping someone here can offer some advice or a solution to a problem I am having.

    I have a Modbus water meter from chinese that connected to word fusion generator FX5U with ADPRW Instruction, but i have a problem. The cumulative flow from water meter is a 4-byte hexadecimal number, with the high bit first and the low bit last.

    I want the output from the PLC is real number FLOAT. can someone in this forum help me to combine 2 different WORD and create a single FLOAT.

    Here I Attached document from water meter.

     

    Thank you,

    Modbus协议英文Modbus water meter communication protocol.pdf

    Re-write from DB to global MEMORY your word like DBx.DBW1>>MW10 and DBx.DBW2>>MW12, then create real format for global memory MD10 (it take's 2 words)

     

    Have a DWORD value.
    Load the high word value into the DWORD.
    Shift the DWORD left by 16-bits.
    Mask in the low word into the DWORD.
    User DWORD_TO_REAL conversion to convert it to the real value.

    MyDword := HighWord;
    SHL(IN := MyDword, N := 16);
    MyDword = MyDword AND LowWord;
    MyReal := DWORD_TO_REAL(MyDword);