0% found this document useful (0 votes)
16 views7 pages

AN0103

About EE072 sensor

Uploaded by

Naveen Kanireddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

AN0103

About EE072 sensor

Uploaded by

Naveen Kanireddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

AN0103

APPLICATION NOTE AN0103

Setup via Modbus RTU


for E+E Devices and Probes.
Supported function codes & packet format

Rev. 1.4 11/2020

Relevant for:

This application note describes how to set the address and the baud rate for E+E devices with Modbus
RTU interface.

Summary:

The application note provides support for setting individually the slave address and the communication.
Additionally it describes the data encoding of floating point values and the Modbus function codes
supported by the E+E devices.

Rev. 1. 4 11/2020 1
AN0103

Contents

Relevant for: ............................................................................................................................................ 1


Summary: ................................................................................................................................................ 1
1 Supported function codes ................................................................................................................ 3
2 Packet format for read coil code 0x01 ............................................................................................. 3
2.1 Example: Reading Status ........................................................................................................ 3
3 Packet format for read function codes 0x03 and 0x04 .................................................................... 3
3.1 Example: Reading Temperature.............................................................................................. 4
4 Packet format for write coil code 0x05 ............................................................................................ 4
5 Packet format for write function code 0x06 ..................................................................................... 4
5.1 Example: Setting a new Slave ID (Modbus address) .............................................................. 5
5.2 Example: Changing the communication settings .................................................................... 5
6 Packet format for write multiple function code 0x10 ........................................................................ 6
6.1 Example: Write pressure compensation value ........................................................................ 6
7 Data encoding of float values .......................................................................................................... 6
7.1 IEEE 754 format ...................................................................................................................... 6
7.2 Modbus floating point format ................................................................................................... 7
Contact information ................................................................................................................................. 7

Rev. 1. 4 11/2020 2
AN0103

1 Supported function codes

Following function codes are supported:

• 0x01 Read Coil Register


• 0x03 Read Holding Registers
• 0x04 Read Input Registers
• 0x05 Write Coil Register
• 0x06 Write Single Register
• 0x10 Write Multiple Registers

The measured values can be read by using 0x03 and 0x04 codes. The register address and the
corresponding physical quantities are listed in the datasheet and in the operation manual of the specific
E+E device.

2 Packet format for read coil code 0x01

Request:
Modbus Function Starting Address Quantity of Coils CRC
Address Code HB LB HB LB LB HB
XX 01 XX XX XX XX XX XX

Response from the E+E Modbus device:


Modbus Function Byte Count N * Coil Status CRC
Address Code HB LB LB HB
XX 01 XX XX XX XX XX

2.1 Example: Reading Status

This example demonstrates reading the device status from a desired register address. The supported
register addresses can be found in the datasheet and in the operation manual of the specific E+E
device.

Request:
Modbus Function Starting Address Quantity of Registers CRC
Address Code HB LB HB LB LB HB
XX 01 00 XX 00 08 XX XX

Quantity of Coils = 8 … 1 Byte (8Bit)

Response from the E+E Modbus device:


Modbus Function Byte Coil CRC
Address Code Count Status LB HB
XX 01 01 XX XX XX

3 Packet format for read function codes 0x03 and 0x04

Request:
Modbus Function Starting Address Quantity of Registers CRC
Address Code HB LB HB LB LB HB
XX 03, 04 XX XX XX XX XX XX

Rev. 1. 4 11/2020 3
AN0103

Response from the E+E Modbus device:


Modbus Function Byte Count N * Registers CRC
Address Code HB LB LB HB
XX 03, 04 XX XX XX XX XX

3.1 Example: Reading Temperature

This example demonstrates reading the temperature (float value) from register address 0x19. A float
value consists of 4 Bytes 1. The byte order of the floating point value is specified in section 7.2.

Request:
Modbus Function Starting Address Quantity of Registers CRC
Address Code HB LB HB LB LB HB
XX 03 00 19 00 02 XX XX

Response from the E+E Modbus device:


Modbus Function Byte 2 Registers (4 byte) CRC
Address Code Count LB HB
XX 03 04 XX XX XX XX XX XX

4 Packet format for write coil code 0x05

Request:
Modbus Function Starting Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 05 XX XX XX XX XX XX

Response from the E+E Modbus device:


Modbus Function Starting Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 05 XX XX XX XX XX XX

The supported register addresses can be found in the datasheet and in the operation manual of the
specific E+E device.

5 Packet format for write function code 0x06

Request:
Modbus Function Register Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 06 XX XX XX XX XX XX

Response from the E+E Modbus device:


Modbus Function Register Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 06 XX XX XX XX XX XX

1 It is highly recommended to request a floating point number with a single command. Otherwise, you may get the

upper and lower part of the floating point value from two different measurements.

Rev. 1. 4 11/2020 4
AN0103

5.1 Example: Setting a new Slave ID (Modbus address)

The new Slave ID (Modbus address) can be set in the range of 1 to 247 by using the 0x06 function
code 2 and register address 0x00.

Request:
Modbus Function Register Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 06 00 00 00 YY XX XX

XX...current Modbus address


YY...new Modbus address (1-247)

Response from the E+E Modbus device:


Modbus Function Register Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 06 00 00 00 YY XX XX

5.2 Example: Changing the communication settings

The baud rate, parity and stop bit can be changed using the 0x06 function code 3 and register address
0x01.

Request:
Modbus Function Register Address Register Value CRC
Address Code HB LB HB LB LB HB
XX 06 00 01 01 4 XX 5 XX XX

Response from the E+E Modbus device:

2 The slave ID cannot be read


3 The register of baud rate cannot be read
4 The devices EE800 and EE10 expect this value as 00
5 The bit 7 of the lower byte must always be zero

Rev. 1. 4 11/2020 5
AN0103

Modbus Function Register Address Register Value CRC


Address Code HB LB HB LB LB HB
XX 06 00 01 01 XX XX XX

6 Packet format for write multiple function code 0x10

Request:
Modbus Function Starting Address Quantity of Byte N * Register CRC
Address Code HB LB Registers Count Values
HB LB HB LB LB HB
XX 10 XX XX XX XX XX XX XX XX XX

Response from the E+E Modbus device:


Modbus Function Starting Address Quantity of Registers CRC
Address Code HB LB HB LB LB HB
XX 10 XX XX XX XX XX XX

The supported addresses can be found in the datasheet and in the operation manual of the specific
E+E device.

6.1 Example: Write pressure compensation value

Set the pressure compensation to 1013.25 mbar (address 0x1388, decimal 5000). The byte order of
the floating point value is specified in section 7.2.

Modbus Function Starting Quantity of Byte CRC


Address Code Address Registers Count 2 Registers (4 byte)
HB LB HB LB LB HB
XX 10 13 88 00 02 04 49 9a 44 7d XX XX

Response from the E+E Modbus device:


Modbus Function Starting Address Quantity of Registers CRC
Address Code HB LB HB LB LB HB
XX 10 13 88 00 02 XX XX

7 Data encoding of float values

The Modbus standard allows for flexible word order, values larger than 16 bits, such as floating point
values (32 bit and 64 bit).

7.1 IEEE 754 format

The IEEE standard definition of single precision floating point values (32 bit, float).

SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM


Byte 1 Byte 2 Byte 3 Byte 4

The IEEE standard definition of double precision floating point values (64 bit, double).

SEEEEEEE EEEEMMMM MM…M MM…M MM…M MM…M MM…M MM…M


Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8

Rev. 1. 4 11/2020 6
AN0103

Description Single precision Double precision


S Sign 1 bit 1 bit
E Exponent 8 bit 11 bit
M Mantissa 23 bit 52 bit

7.2 Modbus floating point format


E+E devices use the Modbus floating point formats. For the single precision format the byte pairs 1, 2 and 3, 4 are
inverted as follows.

MMMMMMMM MMMMMMMM SEEEEEEE EMMMMMMM


Byte 3 Byte 4 Byte 1 Byte 2

For the double precision format the byte pairs from 1 to 8 are inverted as follows.

MM…M MM…M MM…M MM…M MM…M MM…M SEEEEEEE EEEEMMMM


Byte 7 Byte 8 Byte 5 Byte 6 Byte 3 Byte 4 Byte 1 Byte 2

Contact information

E+E Elektronik Ges.m.b.H.


Langwiesen 7
A-4209 Engerwitzdorf
Austria
Tel.: +43 7235 605 0
Fax.: +43 7235 605 8
E-Mail: [email protected]
Homepage: www.epluse.com

For more information got to the download centre on the E+E homepage:
http://www.epluse.com/de/service-support/download-center/

The information in this document is believed to be accurate in all respects at the time of publication but is subject
to change without notice. E+E Elektronik assumes no responsibility for errors and omissions, and shall not
accept responsibility for any consequences resulting from the use of information included herein. Additionally,
E+E Elektronik assumes no responsibility for the functioning of features or parameters not described. E+E
Elektronik reserves the right to make changes without further notice. E+E Elektronik makes no warranty,
representation or guarantee regarding the suitability of its products for any particular purpose, nor does E+E
Elektronik assume any liability arising out of the application or use of any product or circuit, and specifically
disclaims any and all liability, including consequential or incidental damages without limitation. E+E Elektronik
products are not designed, intended, or authorised for use in applications intended to support or sustain life, or
for any other application in which the failure of the E+E Elektronik product could create a situation where personal
injury or death may occur. Should the buyer purchase or use E+E Elektronik products for any such unintended
or unauthorised application, the buyer shall indemnify and hold E+E Elektronik harmless against all claims and
damages.

Rev. 1. 4 11/2020 7

You might also like