I am trying to figure out the math with two U16 values that are converted to a Float(F32) in the TI so as to duplicate in a Siemens S7-1500. Seems like it should be straight but I'm missing something.
In the TI505 we have:
V600 = 17017 U16
V601 = 8360 U16
V603. = 62.2819 F32
In the S7-1500 we have
MW100 = 17017 UInt
MW102 = 8360 UInt
MD104 = 1.115234E+09 Real
I have tried ByteSwap, WordSwap etc.
//Byte Swap
#TmpWord0.%B0 := #UInt0.%B0;
#TmpWord0.%B1 := #UInt0.%B1;
#TmpWord1.%B0 := #UInt1.%B0;
#TmpWord1.%B1 := #UInt1.%B1;
//Word Swap
#TmpDWord0.%W0 := #TmpWord1;
#TmpDWord0.%W1 := #TmpWord0;
//Out
#RealOut := DINT_TO_REAL(DWORD_TO_DINT(#TmpDWord0));
Thanks for responses
In the TI505 we have:
V600 = 17017 U16
V601 = 8360 U16
V603. = 62.2819 F32
In the S7-1500 we have
MW100 = 17017 UInt
MW102 = 8360 UInt
MD104 = 1.115234E+09 Real
I have tried ByteSwap, WordSwap etc.
//Byte Swap
#TmpWord0.%B0 := #UInt0.%B0;
#TmpWord0.%B1 := #UInt0.%B1;
#TmpWord1.%B0 := #UInt1.%B0;
#TmpWord1.%B1 := #UInt1.%B1;
//Word Swap
#TmpDWord0.%W0 := #TmpWord1;
#TmpDWord0.%W1 := #TmpWord0;
//Out
#RealOut := DINT_TO_REAL(DWORD_TO_DINT(#TmpDWord0));
Thanks for responses