Starting up the device - RS 485 Modbus interface
Leuze electronic GmbH + Co. KG
CML 730i
146
Description of the bytes
• Byte 1: slave address
• Byte 2: read access command = 0x03 (repeat of the read command)
• Byte 3: amount of user data (20 – the actual number/length of the sent response data of the read
access)
• Bytes 4 … 35: user data (here, e.g., string with manufacturer designation)
• Bytes 36 … 37: 16-bit error check (Cyclic Redundancy Check, CRC) (see chapter 14.2.3)
14.2.2 Modbus write access
16-bit write access
Description of the bytes:
• Byte 1: slave address
• Byte 2: write access command = 0x10
• Byte 3: module ID = 0x00
• Byte 4: index (here, e.g., 0x10 returns the manufacturer name, see chapter 14.3)
• Bytes 5 … 6: maximum length of the response data in words (16 bit)
• Byte 7: number of bytes of transferred user data (= 2 x value in bytes 5 … 6)
• Bytes 8 … 11: user data
• Bytes 12 … 13: 16-bit error check (Cyclic Redundancy Check, CRC) (see chapter 14.2.3)
Response to 16-bit write access
Description of the bytes:
• Byte 1: slave address
• Byte 2: write access command = 0x10
• Byte 3: module ID = 0x00
• Byte 4: index (here, e.g., 0x10 returns the manufacturer name, see chapter 14.3)
• Bytes 5 … 6: maximum length of the response data in words (16 bit)
• Bytes 7 … 8: 16-bit error check (Cyclic Redundancy Check, CRC) (see chapter 14.2.3)
14.2.3 Error check (CRC calculation)
Example
An example of a C language function performing CRC generation is shown in the following. All of the
possible CRC values are preloaded into two arrays, which are simply indexed as the function increments
through the message buffer. One array contains all of the 256 possible CRC values for the high byte of the
16-bit CRC field, and the other array contains all of the values for the low byte.
Telegram frame:
01
10
00 00
00 02
04
01 01 02 00
3F 36
(byte 1) (byte 2) (byte 3 … 4)
(byte 5 … 6)
(byte 7) (byte 8 … 11)
(byte 12 … 13)
Telegram frame:
01
10
00 00
00 02
3F 36
(byte 1)
(byte 2)
(byte 3 … 4)
(byte 5 … 6)
(byte 7 … 8)
Example from the reference specification:
“MODBUS over serial line specification and implementation guide V1.0”, chapter 6.2.2