Hi, The Modbus feature in Codesys regards incoming variables as 'WORD' types. My RS485 kWhr meter sends data via two 16 bit REAL numbers which form the 'Hi Byte' & 'Low Byte' of the transmitted value. (Definitely overkill for my application.) I can read the separately received WORDS in Codesys but clearly they are unusable in that format. Can someone show me the way to convert these back to a single REAL variable? Thanks in anticipation,
Talk Topic about project #bernie-bbq
That's possible, but it involves some ugly hardware-dependent trickery.
Can you share the platform the Codesys runtime is running on? Both OS and processor.
A REAL is 32 bits wide, google for IEE754
There are many tricks to shuffle 4 bytes into a REAL. Try reading up on a UNION in which you can declare a REAL, 2 WORDS and 4 BYTE's to occupy the same memory space.
Log in to post a comment.