Hello everyone, I have implemented a Modbus485 communication using the ModbusRTU11 library, everything works fine, but I need to write real variables such as voltage and current, what can I do? The FC16 block used accepts in input ONLY an array of words (which I have already assigned) and I cannot convert from real TOWord. How can i solve it? Thanks. A greeting guys.
I think there are at least two options: 1) To convert an array of REAL values to an array of WORD values: On an instance of the REAL_TO_BUF function block, the SRC input/output will be your array of (32 bit) REAL values, and the BUFFER input/output will be the array of (16 bit) WORD values that you use on the FC16 FB. 2) To convert a single REAL value to two WORD values: Please see this conversation: https://www.plcnext-community.net/index.php?option=com_easydiscuss&view;=post&id;=1272&Itemid;=221⟨=en#reply-1343 That shows how to convert a REAL to a DWORD. After that, you can copy the two halves of the DWORD to two elements in a WORD array, for example: MyWordArray[1] := MyDWord.W0; MyWordArray[2] := MyDWord.W1; I hope this helps.