How do you configure a Modbus slave using the "RCV_341" (FB 121) PCS 7 block?
You can use the "RCV_341" block to receive data from a Modbus Master System.
It calls the blocks FB 122, FB 80 and SFB 35 and supports messaging via Alarm 8P.
The type of the data received depends in each case on the Function Code (FC) of the Modbus message. This defines what type of data can be read and written.
The following table shows the various function codes with their meanings and addresses.
|READ Data||WRITE Data||Modbus Data Memory
|FC 01||FC 05||Single Coil (HC)||1 Hex|
|FC 15||Multiple HC|
|FC 02||Input Status (IC)||10001 Hex|
|Reserve (not used)||20001 Hex|
|FC 04||Input Register (IR)||30001 Hex|
|FC 03||FC 06||Holding Register (HR)||40001 Hex|
|FC 16||Multiple H|
Detailed descriptions of the separate function codes are available in Entry ID: 1220184.
Hardware and software requirements
The following hardware and software components are required to connect an ET 200M as Modbus slave to PCS 7:
- CP 341 module: 6ES7 341-1xH01-0AE0 (x:= A: RS232; x:= B: TTY; x:= C: RS422 / 485).
This card is always supplied with the installation CD for PtP communication.
- Single license (MODBUS slave): 6ES7 870-1AB01-0YA0.
This delivery package includes the installation CD for the retrofittable MODBUS slave driver, documentation and a hardware dongle for the CP341.
The single license (MODBUS slave) can also be ordered without software and documentation: 6ES7 870-1AB01-0YA1.
In a redundant configuration of ET 200 M, you need two CP 341s and two licenses. In this case, it is sufficient to order the license once with software and documentation.
Proceed as follows to receive data in Modbus Slave mode via the "RCV_341" block.
|1||Connect a DP master system in the HW Config and add an ET 200 M to it by drag-and-drop.|
|2||Insert a CP 341 in the ET 200 M.
|3||Open the properties of the CP 341  and in the "General" tab, click on the "Parameter..." button .|
|4||Set the protocol to "MODBUS Slave" .|
|5||Open the protocol settings by double-clicking on "Protocol" . Parameterize the relevant storage locations and limit values for the various function codes.|
For example, DB 20 for function codes 03, 06 and 16.
If the MODBUS master sends a message now, this is evaluated accordingly by the slave and depending on the function code in the message, the data is stored in the data blocks and markers set in the CP 341 (e.g. DB 20 for FC 03, 06, 16).
|6||Load the driver once into the CP 341 (click on "Load Drivers" as shown in Fig. 02 ).|
|7||Compile and load the HW Config.|
|8||Now create a CFC chart on the side of the MODBUS slave.|
|9||Insert a "RCV_341" block into this CFC chart.|
|10||Set the address of the CP 341 from the HW Config via the "LADDR" parameter.|
|11||Change the "MODB_SL" parameter to the value "1" (in this way the "R_DATA" value cannot be changed, because the block is now working in Slave mode.
Now, when you compile, the parameters "MODE", "SUBN1_ID", "SUBN2_ID", "RACK_NO" and "SLOT_NO" are parameterized and connected automatically.
|12||Now create the DB 20 set in the Properties of the CP 341, in which the data received is to be stored.|
|13||Once the charts have been loaded, you can monitor the data received via a corresponding tag table, for example.