Modbus Communication With EK2x0 - V2.0 - D
Modbus Communication With EK2x0 - V2.0 - D
with
Modbus Communication with
Volume
VolumeConversion Devices
Conversion Devices
EK220,
EK220, EK230,
EK230, EK260EK280
EK260,
Appendix ...................................................................................................................................... 56
A-1 Basic Modbus Description .................................................................................................. 56
A-2 Various Implementations .................................................................................................... 56
A-3 Protocol Versions ................................................................................................................ 57
The bus mode is only available by EK220 from version V1.20 on!
The EK220 must be installed outside Ex-Zone 1! Use of the bus structure is not
allowed in hazardous area!
An external power supply 5-9 VDC (EK220) is required for Modbus communication and at
least one “call acceptance window” has to be open.
The terminal R+ must be connected to T+ and R- to T- (external of the EK220).
To take care against Electromagnetic Interferences (EMC) we strictly would recommend
using a galvanic isolation between the EK220 and the PLC / SCADA system!
Note 1: EK220 uses per default a 4-wire RS-485 interface (similar to a RS-422). So, R+,
R-, T+ and T- are connected separately. If the user wants to use the above described two-
wire- mode the bus mode (address: “02:704”) must set to “1” (= two-wire mode).
Note 2: Standard PCs do not have a RS-485 interface on board. In this case a converter
from RS-485 to RS-232 like an ADAM-4520 has to be interconnected between the RS-232
port of the PC and the RS-485 interface terminals of EK220 (see picture above).
Note 3: The two-wire mode is not supported via EK260. There is an external RS-485 (2w)
RS-422 (4w) converter necessary.
The Ethernet card inside the EM260 must be set to automatically answer the incoming call
by itself (ATS0=1)!
The EK220 can be installed inside Ex-Zone 1; the FE260 must be installed in Ex-Zone 2 or
outside the hazardous area!
External power of +9VDC (Ex – safe) is supplied from FE260.
For read-out communication with EK220 at least one lock (customer lock, suppliers lock,
calibration lock) must be open. For writing e.g. gas data at least the suppliers lock or the
calibration lock must be open.
Inside the FE260, different kinds of modems can be used: PSTN, ISDN, GSM, GPRS
(ComTCPServ), RS-232 / RS-485 or Ethernet card. If a modem is used, the modem must
be set to automatically answer the incoming call itself (ATS0=1)!
Inside the FE260, different kinds of modems can be used: PSTN, ISDN, GSM, GPRS
(ComTCPServ), RS-232 / RS-485 or Ethernet card. If a modem is used, the modem must
be set to automatically answer the incoming call itself (ATS0=1)!
The EK260 can be used only with 4-wire (RS-422) point-to-point connections.
If you want to use it on a 2-wire RS-485 bus system together with other devices, you need
a RS-485/RS-422 converter like the CommFront. RPT-485_422-4 type.
No switches need to be set on the CommFront. converter. Modbus settings on the EK260
are the same like on a EK220 but without a Bus-mode setting.
Test specifications
Baud rate / Data format of all bus devices: 9600 Bd / 8n1
EK260 Modbus slave address: 1
EK220 Modbus slave address: 2
EK220 Bus mode: on
EK260 Bus mode: n/a – only in 4w RS-485 connection usable
(Bus mode is emulated by the CommFront.
“RPT-485_422-4” – Converter)
EK2x0 Md.S2: 13 (Modbus)
EK2x0 Typ.S2: 2 (RS-485)
The EK220 and EK260 can be installed inside Ex-Zone 1; the FE260 must be installed in
Ex-Zone 2 or outside the hazardous area!
External power of +9 VDC (Ex – safe) is supplied from FE260 to each EK2x0 separately.
For read-out communication with EK2x0 at least one lock (customer lock, suppliers lock,
calibration lock) must be open. For writing e.g. gas data at least the suppliers lock or the
calibration lock must be open.
EK220
Description Type EK220 Setting
Address
RS-232,
TypS2=1 (RS-232)
Interface RS-485 02:70A
TypS2=2 (RS-485)
Ethernet module 1,2)
Modbus ASCII, MBTrM=0 (ASCII)
Communication
Modbus RTU, 02:7B1 MBTrM=1 (RTU)
protocol
Modbus TCP 2) MBTrM=2 (TCP)
Bd.S2= 300, 600, 1200,
Baud rate in bit/s 02:708
2400, 4800, 9600, 19200
7e1, DF.S2=0 (7e1)
Data format 7o1, 02:707 DF.S2=1 (7o1)
8n1 DF.S2=2 (8n1)
Two-wire 2,3,4)
Bus mode (only in RS- BusS2=0 (4-wire mode)
Four-wire 02:704
485 mode possible) BusS2=1 (2-wire mode)
ASCII mode
COM port “1”
Change the string to following setting (Example: IP address: 10.1.200.22; Port = 37359):
Another helpful check could be to test the communication under WinPADS TCP/IP:
Action – Start connection via – TCP-IP (or push F 9). Input IP-address and IP-port in the
shown format: 10.1.200.22:37359 to open TCP/IP connection to EK220:
Now the Ethernet module works well only for IEC 62056-21 communication.
Abbreviated EK220
Description EK220 Setting
Designation Address
Mode, interface 2 Md.S2 02:705 Modbus 13
Data format, interface 2 DF.S2 02:707 8n1 2
Baud rate, interface 2 Bd.S2 02:708 19200 Bd
Type, interface 2 TypS2 02:70A RS-232 1
Bus mode RS-485 on/off BusS2 02:704 BusS2 = off 0
Transmission mode MBTrM 02:7B1 TCP 2
Via “Read Modbus config...” you can store the actual Modbus table in a file on your PC
(e.g. to set all other EK220 in your system to the same Modbus table (via “Send Modbus
config..“).
With button “Delete all…” you can delete the whole Modbus table – please do it.
In the same way the other data Vmtotal, Vbtotal are inputted as long integers (Ulong) in the
Modbus Register list.
Flow rates, pressure, temperature and several other data are defined in the data type
IEEEfloat starting for example with Modbus address 301.
If the post decimal places of Vmtotal and Vbtotal should be displayed in Mdbus.exe they can
be defined as Ushort. For the starting address of Ushort-type data, “1” is used.
With “↑” the both values are shifted to the top of the list:
LIS-address LIS-address
Value EK220 EK230 EK260
Current value Last value
Measurement period counter Vb
1:0160 1:0161
(digits before the decimal point)
digits before the decimal point 1:0160_1 1:0161_1
decimal places 1:0160_2 1:0161_2
Daily counter Vb 2:0160 2:0161
Max. meas. period value Vb of the
3:0160 3:0161
month
Max. daily counter Vb of the
4:0160 4:0161
month
Max. flow rate Qb of the month 5:0160 5:0161
Min. flow rate Qb of the month 6:0160 6:0161
End meter reading Vb of the 7:0160
7:0161
month (= 2:300)
Measurement period counter Vm 8:0160 8:0161
Daily counter Vm 9:0160 9:0161
Max. meas. period value Vm of
10:0160 10:0161
the month
Max. daily counter Vm of the
11:0160 11:0161
month
Max. flow rate Qm of the month 12:0160 12:0161
Min. flow rate Qm of the month 13:0160 13:0161
End meter reading Vm of the 14:0160
14:0161
month (=4:300)
Mean value for T (meas. period) 15:0160 15:0161
Monthly mean value for T 16:0160 16:0161
Monthly max for T 17:0160 17:0161
Monthly min for T 18:0160 18:0161
Mean value for p (meas. period) 19:0160 19:0161
Monthly mean value for p 20:0160 20:0161
Monthly max for p 21:0160 21:0161
In the Modbus map of the EK2xx the address “07:0161” and “07:161_2” must be used:
Note: Via “Edit” you have to use the button “Direct input of addresses..:” because the
address 07:0161_2 is not available in the tree structure of the standard values!
Note: The corresponding time stamp for this value is the address xx:0165.0.
For the current value (07:160) it’s the address xx:0164.0!
Note: The Vm may (current month) in our example can be read out via Modbus register
103 till 105.
But for the maximum value there is also the date and time needed, when these
maximum happened.
For the current value (xx:0160.x) the corresponding LIS-200 address for date and
time is the xx:0164.0 and for the last value (xx:0161.x) it’s the address xx:0165.0!
Note: For analogue values the value is transferred with decimal places. Take care about
the following post decimal places:
- Temperature T: 2 digits
- Pressure p: 5 digits
- K-value k: 5 digits
- Conversion factor C: 5 digits
Qbmax (current month) = 144,58 m3/h at 09. of August 2011 at 14:27:08 o’clock!
Qbmax (last month) = 49,37 m3/h at 31. of March 2010 (not real) at 00:23:18 o’clock!
If manually changes are made in the list please check the Modbus addresses!
If register size is “2” (16 bit register) as shown here, the Modbus addresses must increase
in steps of 2 if they should be displayed via Modbus together:
With “Write” you can also transfer multiple values via Modbus:
Modbus Communication with EK2x0_V2.0_d.docx 35
36 Modbus Communication with EK2x0_V2.0_d.docx
7 Reading-out Fixed Archives EK2xx via Modbus
For archived values, there are no corresponding LIS200-addresses available. Because of
this, another addressing mechanism was implemented to read out archives via Modbus.
For the desired archive a Modbus start address must be assigned. Starting from this
address, the desired columns of the archive can be read out. The start address belongs to
the actual data set in the archive.
To read out archived data, the desired columns, and the desired output data format of
these columns have to be parameterized. The number of possible columns varies
according to the device types and software releases.
The order of the values within the answer telegram starts at the current (newest) dataset
and then goes back to the older ones.
The recorded datasets of archives within a device are normally store at periodic events, for
example hourly or daily periods. To read out only these datasets the standard archives
contain one column, which stores the event, which causes this dataset.
Note: The archives can also be stored at special events e.g. modification of
date/time or counter reading. For transmission archives via Modbus the read
out software can only get the datasets caused by the periodic events. All the
other datasets of non periodic events are skipped by the Modbus read out
application.
Note: After each of the 4 counter columns Vb, VbT, Vm and VmT there are additional
columns of the increments from the previous stored counter value available.
These increment values can be displayed in the volume conversion display and
transferred via Modbus but not transferred via WinPADS. Anyhow, the increment
columns must be considered in the column order to be outputted correctly.
Explanation:
The default setting for the start address (2:7B3) is “2001” and the number of archive rows
for Modbus transmission (2:7B4) is: “11”.
If for example the mean temperature (Offset = 16) of the third last entry in the archive
has to be read-out, then the number of the register is
16 + (26 * (3-1)) + 2001 = 2069
Note: The number of entries refers only to the event “measurement periods end”.
Any other entries in the archive are ignored. That means a change of a meter
reading, date & time or special entries (warning or alarm) are not transmitted
via Modbus!
7.2.1 Example
Archive content of the measurement period archive EK260 (version V2.55):
Interpretation:
Reg. No. Content Meaning Result See chapter
2001 9856 Consumption of the standard
x.9856 m3
volume (post decimal places)
2002 0000 Consumption of the measured
x.0 m3
volume (post decimal places)
2003 0000 0053 Consumption of the standard
53.x m3
volume (pre decimal places)
2005 60 Consumption of the measured
60.x m3
volume (pre decimal places)
2007 0000 0000 Status bits 16-1 “0” Detection of the
Note: transmission as Ulong; messages:
but inside EK260 only Ushort A-8.3
used; so MSWord not used
2009 - 0035 0000 standard volume in Format 53,9856 m3 A-8.5
2011 2680 Counter 6 (always LSB first)
2012 - 003C 0000 Measured volume in Format 60,0000 m3 A-8.5
2014 0000 Counter 6 (always LSB first)
2015 3F81 0E02 Mean value pressure 1,0082 bar A-8.9
2017 41E5 AE14 Mean value temperature 28,71 °C A-8.9
2019 - 0000 0000 standard volume in Format 53,9856 m3 A-8.8
2022 9856 0053 Array 8 (BCD format)
2023 - 0000 0000 Measured volume in Format 60,0000 m3 A-8.8
2026 0000 0060 Array 8 (BCD format)
Pressure
Temperature
Pressure
Temperature
To read-out the desired data via Modbus, the following wpp-file has to be transferred into
the volume converter. Alternatively the same content can be send as single write
commands using the User list in the WinPADS:
# Daily Archive 7
The setting must be done for the daily archive (archive 7). The start address of the archive
is 7000. Take care that these addresses are higher than the used standard Modbus
addresses for the registers (see chapter: 3.1)!
Note: Only archive lines with the event “meas. period end” will be transferred via
Modbus. All archive lines which based on special events are filtered out of
the Modbus transmission!
And so, the Modbus address for the previous line is 7000 + 10 = 7010:
The time stamps are in UNIX time format: So the difference between two time stamps, e.g.
1266472800 – 1266386400 is 86400 s (= one day in seconds).
„Unix time, or POSIX time, is a system for describing points in time, defined as the
number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of
January 1, 1970, not counting leap seconds.“ (en.wikipedia.org)
For calculating the right time there are
tools available; e.g.: www.unixtime.de
(in German):
Note: This tool is based on the time
in Germany (GMT+1h) and
adds an offset of 1h during
summer time (GMT+2h)!
The “Date and time” can be entered via drag and drop or by push on the arrow → to the
window “Columns flexible Archive”.
This archive content can be outputted via Modbus as shown on chapter 8.2.
Note: You’ll get the information if the regarding archive content of one or more changed
archives will be preserved or deleted.
Finally push the button “Apply…” to save the inputs and changes.
The archive columns can be displayed via WinPADS after some days (via button “show
content” from first picture on page 47):
So the last entry of the configured flexible archive can be reached via Modbus register
number 20000. The entry before can be calculated via the sum of all Modbus register
numbers (see screen shot above). So the next entry can be reached via Modbus register
number 20012!
Note: Only archive lines with the event “meas. period end” will be transferred via
Modbus. All special events are filtered out of the transmission.
Depend on the required number of archive lines which must be read out via Modbus the
start address for the next archive transmission via Modbus can be calculated as follows:
<No of required entries> * <No. of entries per line> + < start address>
e.g. 1000 * 10 + 20000
The start address for reading-out the next archive via Modbus must be grater than
30000; e.g. 35000 (see also chapter: Fehler! Verweisquelle konnte nicht gefunden
werden.)!
Note: Take care that the start addresses are also higher than the used standard Modbus
addresses for the registers (see chapter: 3.1)!
If an error occurred, the first bit of above function code “04” (= 0000 0100) send is set to
“1”, so the response from the slave is: “84” (= 1000 0100).
The meaning of the exception code is described in chapter A-9!
Elster address ranges for reading out single values and archives
Current LIS200-values can be read out by their corresponding Modbus (register)
addresses.
Note: The references described by the Modbus Protocol Reference Guide (e.g. 4x
references, holding registers) are not implicit used by the EK2xx. That means if a
PLC requires these references the necessary address had to be entered explicit in
the Modbus map; e.g. address 40337 = act. pressure.
The values of archives can’t be read out in this way, because they have no corresponding
LIS200-addresses. Therefore, another mechanism was installed to read out these
archived values.
This mechanism divides the whole Modbus (register) address range into three parts:
The lower part is defined from address “1” to “X-1” and contains current values. The
access is carried out as described in chapter 6. In the enclosed example below the
address range is defined from 100 to 999.
The middle part is defined from address “X” to “Y-1” and contains archived values from
single archives. This address range can be partitioned to all the available single archives.
The access is carried out as described in chapter 7 or 8.2. In the enclosed example below
the address range is defined from 1000 to 1999 for the measurement period archive and
from 2000 to 2999 for the daily archive.
The upper part is defined from address “Y” to “65535” and contains archived values
from combined archives. This address range can be partitioned to all the desired archives.
In the example below the address range is defined from 3000 to 65535. Because this is a
rarely used special application, it is currently not supported by Elster devices.
Modbus
register Content of the values:
addresses
Combined
Measurement- and
Daily Archive
3000 ->
Daily Archive
2000 ->
Measurement
Period Archive
1000 ->
Single Values
100 ->
More registers can be combined to form longer ASCII strings. Each register is being used
to store two ASCII characters (two bytes).
No of.
Format Code Length Format Scaling
Register
Ushort 3 16 Bit Digit binary 1 n*1
Ulong 4 2x16 Bit Digit binary 2 n*1
2x16 bit (Ulong) -4
Counter6 9 Counter binary 3 n*10
+ 16 Bit (Ushort)
Array2 12 16 Bit BCD coded decimal 1 n*1
Array4 14 2x16 Bit BCD coded decimal 2 n*1
Array6 16 3x16 Bit BCD coded decimal 3 n*1
Array8 17 4x16 Bit BCD coded decimal 4 n*1
IEEEfloat 32 2x16 Bit Exponential binary 2 n*1
Code: The code number is used inside the EK2xx to program the necessary data format
for each parameter of the Modbus map.
A-8.4 Ulong
Reg. Short Description Unit Scaling LIS-200
designation address
101 VmT Total actual volume (pre-decimal places) m3 n*1 4:302_1
Note: By data format “Ulong” the setting of the word order has to be clarified!
Note: By data format “Counter6” the setting of the word order has to be clarified for the pre-decimal
places!
A-8.6 Array2
Reg. Short Description Unit Scaling LIS-200
designation address
820 DayB Day boundary (shown as time: hh:mm) - n*1 2:141_1
A-8.7 Array6
Reg. Short Description Unit Scaling LIS-200
designation address
817 S.No Serial number - n*1 1:180
A-8.9 IEEEfloat
Reg. Short Description Unit Scaling LIS-200
designation address
337 p Gas pressure bar n*1 7:310_1
339 T Gas temperature °C n*1 6:310_1
311 C Conversion factor - n*1 5:310
313 K Gas law deviation factor - n*1 8:310
327 Q Flow rate m3/h n*1 4:310
333 Ho.b Calorific value kWh/m3 n*1 10:314_1
Note: By data format “IEEEfloat” the setting of the word order has to be clarified!
The setting can be done via WinPADS (register card “Interface”, “Modbus configuration”):
On the left you see the graphic of Big-Endian architecture, on the right the alternative
Little-Endian architecture:
a: 0A
a+1: 0B
a+2: 0C
a+3: 0D
Big-Endian
Note:
The original Modbus capable PLC’s used the Big-Endian architecture. Most modern PLC’s
are based on common microprocessors using the Little-Endian architecture. So, as the
factory setting of the EK2xx we use also the Little-Endian architecture (L word first).
The fact that Modbus is used to exchange data between these two architectures
introduces some possibilities of failure, if the complete details are not considered.
Devices
Functionalities
EK220 EK230 EK260
Single values (meter reading, meas. values,
From V1.00 From V1.61 From V2.50
parameters…)
Measurement period archive From V1.00 From V1.61 From V2.50
Other single archives From V1.00 From V1.61 ---
Combined archives From V1.00 From V1.61 ---
Modbus TCP From V1.21 --- From V2.53
No. of Modbus registers 60 40 40
Register size four bytes From V1.00 --- ---
Bus mode (real RS-485) From V1.21 --- ---
Lock handling (e.g. open/closing of supplier
From V1.32 --- ---
lock to set parameters like date/Time etc.)
Modbus in battery mode (Md.S2 = “14”) From V1.32 --- ---
Note: Depending on the Modbus master software, the supplier code must be “translated”
into “BCD” before it can be transferred via “Array4” data format to the EK220!
E.g. the Modbus simulation software Simply Modbus doesn’t support “BCD”
representation of values, so the requested value “12345678” must be converted
from “HEX” to “DEZ” (305419896). With this value, the right code will be
transferred as a “HEX” value “12345678” to the EK220.
Note: If data format “Array4” is used, the transmission mode „L word first“ or „H word
first“ doesn’t have any influence on the BCD coding used here.
If the default settings should be reinstalled, first of all delete the actual settings and load
(push “Send param. file” button) the corresponding wpp-file for e.g. EK220 which is
available on the CD or can be downloaded from our website. The path to this file on CD is:
“…\WinPADS\EK200\PROFILES\EK220\V1.2x\Applications”.
The name of the file is “EK220 - Modbus Elster-Instromet_*.WPP”.
The interface mode Md.S2 is automatically set to “Modbus” during the download of the
wpp-file. If Md.S2 is set to another value, the button “Activate Modbus” appears (see
above). A click on this button sets “Md.S2” to Modbus” and the button “Activate Modbus”
disappears.
1...60:08C0 MAd1...60 Modbus map – external address (only for EK220) EK260 / EK230: 1…40
1...60:08C1 LAd1...60 LIS-200 address (only for EK220) EK260 / EK230: 1…40
1...60:08C2 Fmt1...60 Modbus format code (only for EK220) EK260 / EK230: 1…40
For communication with Excel via poke commands check Excel DDE and Macro DDE.
Mdbus program default is: these fields are unchecked.
Elster GmbH
May 2012