[[Template core/front/global/updateWarning is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
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 toword fusion generatorFX5U 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.
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);
How to combine 2 different WORD to create a single FLOAT
in Mitsubishi
Posted
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);