Loadable Driver for Point-to-Point CPs: MODBUS

Loadable Driver for Point-to-Point CPs: MODBUS Protocol, RTU format, S7 is Slave
Function code 06 - Preset Single Register
Function code 06 - Preset Single Register
Function
This function enables the MODBUS master system to write a data word in a data block of the
CPU.
Request Message Frame
ADDR
FUNC
start_register
DATA value (High, Low)
CRC
FUNC
start_register
DATA value (High, Low)
CRC
Reply Message Frame
ADDR
start_register
The MODBUS register address "start_register" is interpreted by the driver as follows:
For further address generation, the driver uses the "base DB number" commencing at DB xxxxx
entered in the dialog box "Conversion of MODBUS Addressing for FC 03, 06, 16" during
parameter assignment .
The address calculation for access, address conversion, is carried out in two steps as follows:
Access to
SIMATIC
Conversion formula
Data block DB
(resulting DB)
=
(base DB number xxxxx + start_register-offset_DB_no.)
Data word DBW
=
(start_register word_No.
∗ 2)
Calculation Formula for start_register
Providing the resulting DB to be written is known, the MODBUS address start_register required
in the master system can be calculated in accordance with the following formula:
This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims
all liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties. The complete
documentation can be found at:
/dokumentation/default.aspx?DocVersionId=17477100939&Language=en-US&TopicId=13407708427
6/18/2017
Loadable Driver for Point-to-Point CPs: MODBUS Protocol, RTU format, S7 is Slave
Function code 06 - Preset Single Register
start_register
=
((resulting DB – base DB number) * 512) + (data word_DBW / 2)
Only even numbered data word numbers are permissible.
DATA Value
Any value can be used as the DATA value, register value.
Application Example
Example of parameter assignment:
Table 1
Conversion of MODBUS addressing for function codes FC 03, 06 and 16
MODBUS address in
transmission message frame
SIMATIC memory area
0
commence at data block
(base DB number)
DB 800
Request message frame FUNCTION 06:
05H
Slave address ADDR
06H
Function code FUNC
01H
start_register "High"
80H
start_register "Low" DBW 768
2BH
DATA value "High"
1AH
DATA value "Low"
xxH
CRC check code "Low"
xxH
CRC Check Code "High"
Reply message frame FUNCTION 06:
05H
Slave address ADDR
06H
Function code FUNC
01H
start_register "High"
80H
start_register "Low" DBW 768
2BH
DATA value "High"
1AH
DATA value "Low"
xxH
CRC check code "Low"
This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims
all liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties. The complete
documentation can be found at:
/dokumentation/default.aspx?DocVersionId=17477100939&Language=en-US&TopicId=13407708427
6/18/2017
Loadable Driver for Point-to-Point CPs: MODBUS Protocol, RTU format, S7 is Slave
Function code 06 - Preset Single Register
xxH
CRC Check Code "High"
Address Calculation:
The MODBUS address "start_register" 0180 Hex (384 decimal) is interpreted as follows:
Access is made to DB 800, data word DBW 768.
Further examples
For further access examples, please refer to FC 03.
This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims
all liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties. The complete
documentation can be found at:
/dokumentation/default.aspx?DocVersionId=17477100939&Language=en-US&TopicId=13407708427
6/18/2017