This shows you the differences between two versions of the page.
| — | comfilehmi:hmieditor_address:index [2026/02/20 15:37] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Device Addressing ====== | ||
| + | |||
| + | 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' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | 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 '' | ||
| + | |||
| + | * **If the address is left blank, there will be no communication with the device** | ||
| + | |||
| + | ===== Data Types for Word Addresses ===== | ||
| + | |||
| + | 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. | ||
| + | |||
| + | <code xbasic> | ||
| + | #include " | ||
| + | |||
| + | Opencom 1, | ||
| + | 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 | ||
| + | |||
| + | ' | ||
| + | Bytes = Peek(Memadr(Value), | ||
| + | _D(0) = Bytes.Word0 | ||
| + | _D(1) = Bytes.Word1 | ||
| + | |||
| + | Delay 1000 | ||
| + | Loop | ||
| + | </ | ||
| + | |||
| + | The example below demonstrates how to convert two adjacent 16-bit registers, //D0// and //D1//, back to a floating point value | ||
| + | <code xbasic> | ||
| + | ' Load Bytes with the raw byte data of D0 and D1 | ||
| + | Bytes.Word0 = _D(0) | ||
| + | Bytes.Word1 = _D(1) | ||
| + | |||
| + | ' Load Value with the raw byte data stored in Bytes | ||
| + | Poke Memadr(Value), | ||
| + | </ | ||
| + | |||
| + | ===== Address Offset ===== | ||
| + | |||
| + | An offset can be added to an address in the form of an [[: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | [[comfilehmi: | ||