User Tools

Site Tools

한국어

comfilehmi:hmieditor_address:index

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'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 DeviceID:Address.

  • 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. 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.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

' 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), Bytes, 4

Address Offset

An offset can be added to an address in the form of an expression to have the address dynamically computed.

Back to ComfileHMI

comfilehmi/hmieditor_address/index.txt · Last modified: 2022/04/22 12:50 by COMFILE Technology