Mb_Slave - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

STATUS value
(W#16#....)
8188
8189
818A
818B
818C
8200
6.3.2.3

MB_SLAVE

The MB_SLAVE instruction allows your program to communicate as a Modbus slave using a
port on the Point-to-Point (PtP) CM 1241 RS485 or CM 1241 RS232 module. A Modbus
RTU master can issue a request and then your program responds via MB_SLAVE execution.
You must assign a unique Instance Data Block when you place the MB_SLAVE instruction in
your program. This MB_SLAVE Instance Data Block name is used when you specify the
MB_DB parameter on the MB_COMM_LOAD instruction.
Modbus communication function codes (1, 2, 4, 5, and 15) can read and write bits and words
directly in the PLC Input Process Image and Output process Image. The following table
shows the mapping of modbus addresses to the process image in the CPU.
MB_SLAVE Modbus functions
Codes
Function
01
Read bits
02
Read bits
04
Read words Input
05
Write bit
15
Write bits
Modbus communication function codes ( 3, 6, 16) use a separate and unique Modbus
holding register data block that you must create, before you can specify the MB_HOLD_REG
parameter on the MB_SLAVE instruction. The following table shows the mapping of Modbus
holding register to the MB_HOLD_REG DB address in the PLC.
MB_SLAVE Modbus functions
Codes
Function
03
Read words
06
Write word
16
Write words
The following table shows the supported Modbus diagnostic functions.
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
Description
Invalid Mode value or write mode to read only slave address area
Invalid Data Address value
Invalid Data Length value
Invalid pointer to the local data source/destination: Size not correct
Pointer to a type safe DB type DATA_PTR (must be a Classic DB type)
Port is busy processing a transmit request
Data area
Address range
Output
1
Input
10001
30001
Output
1
Output
1
Data area
Address range
Holding
40001 to 49999
Register
400001 to 465535
Holding
40001 to 49999
Register.
400001 to 465535
Holding
40001 to 49999
Register
400001 to 465535
Data area
to
8192
Output Process Image
to
18192
Input Process Image
to
30512
Input Process Image
to
8192
Output Process Image
to
8192
Output Process Image
CPU DB data area
MB_HOLD_REG
MB_HOLD_REG
MB_HOLD_REG
Programming instructions
6.3 Global library instructions
S7-1200
CPU address
Q0.0 to Q1023.7
I0.0 to I1023.7
IW0 to IW1022
Q0.0 to Q1023.7
Q0.0 to Q1023.7
S7-1200
CPU DB address
Words 1 to 9999
Words 1 to 65535
Words 1 to 9999
Words 1 to 65535
Words 1 to 9999
Words 1 to 65535
199

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SIMATIC S7 and is the answer not in the manual?

This manual is also suitable for:

Simatic s7-1200

Table of Contents

Save PDF