In this section device refers to the PLC or MCU that is connected to the ComfileHMI hardware.
The ComfileHMI needs to know the address of the device in order to communicate with it.
In each widget's property page, the device's address space can be configured.
Pressing the .. button will open the following window where device and device address can be bound to the widget.
The address value must expressed in the format
Word Addresses can be used to read/write data 16-bit signed and unsigned integers, 32-bit signed and unsigned integers, and 32-bit floating point values.
The following code can be used in CUBLOC devices to store floating point values in the Modbus registers. The example below stores the floating point value Value into the two adjacent 16-bit registers D0 and D1.
#include "MSB6XX" Opencom 1,115200,3,1024,1024 Set Modbus 1,1,20 Set Ladder On Dim Value As Single Value = 3.14 Dim Bytes As Long Bytes = 0 Do Value = Value + 0.01 Debug Fp(Value, 3, 2), Cr ' Store floating point Value To D0 And D1 Bytes = Peek(Memadr(Value), 4) _D(0) = (Bytes.Byte1 << 8) Or Bytes.Byte0 _D(1) = (Bytes.Byte3 << 8) Or Bytes.Byte2 Delay 1000 Loop