Posted 2 Jul 2021 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 my 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 Share this post Link to post Share on other sites
Posted 3 Jul 2021 On 02.07.2021 at 0: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 my 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 BMOV https://forums.mrplc.com/index.php?/topic/40236-dword_to_real/ Share this post Link to post Share on other sites
Posted 12 Jul 2021 On 7/3/2021 at 10:38 PM, Neverov said: BMOV https://forums.mrplc.com/index.php?/topic/40236-dword_to_real/ Thank you in advance for answering my question. but I haven't been able to solve the problem. I'm very happy if you can show me how in detail so that "2 WORD" becomes "1 FLOAT" for example if D0 = 0X0002, and D1 = 0X23FF. I want the output to be D2 = 0X000223FF. I'm still really a beginner in the PLC world Share this post Link to post Share on other sites
Posted 12 Jul 2021 (edited) 5 hours ago, RikiWatasuta said: Thank you in advance for answering my question. but I haven't been able to solve the problem. I'm very happy if you can show me how in detail so that "2 WORD" becomes "1 FLOAT" for example if D0 = 0X0002, and D1 = 0X23FF. I want the output to be D2 = 0X000223FF. I'm still really a beginner in the PLC world Here's an example. Can anyone have a more elegant solution? forums.mrplc.com.gx3 Edited 12 Jul 2021 by Neverov Share this post Link to post Share on other sites
Posted 12 Jul 2021 27 minutes ago, Neverov said: Here's an example. Can anyone have a more elegant solution? forums.mrplc.com.gx3 thank you very much for providing an easy to understand example. now my problem has been solved. Share this post Link to post Share on other sites
Posted 24 Nov 2022 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); Share this post Link to post Share on other sites