[Programming] Communication between 2 PLCs S7-1200

Hi,

Today, I will show you how to transfer data between 2 PLCs S7 1200.

Step 1: create a new project.

Step 2: add 2 plc master and slave

The master PLC is CPU 1214 AC/DC/Rly, I select model BG40

And the slave PLC is CPU 1212 DC/DC/Rly, I select model HE40

Step 3: come to Network view and connect 2 PLC together.

Click and hold mouse to connect 2 green squares.

Step 4: configure Ethernet address for 2 PLC

The master PLC address is 192.168.0.1 and the slave address is 192.168.0.2

1 important thing need to be done is permitting access with PUT/GET communication for 2 PLCs

Connection mechanisms setting, we tick on this box.

And we do the same with the slave PLC

I will change the name of PLC1 to Master and PLC2 to Slave

Step 5: program  for reading data from Slave and transfer to Master.

In OB1 of Master, in the instructions of communication, S7 communication part, select GET module and drag to program workplace here. This is the name of this GET module, I let the default name GET_DB.

We need to configure the connection for GET module

Right click and select Properties

Come to Connection parameter, in the partner here, we select the slave PLC, after we select, these information will be automatically appear .

Step 6: come to Block parameter to configure parameter of GET module:

First is Request input, this is the request to use this module.

Next parameter is read area, this is address in slave PLC that master PLC will read the data from.

Next is Store area, this is address in master PLC that master will store the data read from slave

Next is output of module, the request completed (NDR), this signal is indicated when request is completed successfully.

The Error is indicated whenever an error happened while processing a request

And the final one is Status to show information of error.

OK, now we add the tag to parameter of GET module here.

REQ here, we put GET_DB and REQ

For ID, we let default

NDR, ERROR and STATUS we put the tag in GET_DB

Step 7: input the read area of slave PLC and store area in master PLC.

For the store area in Master PLC, I will create new data block DataFromSlave here and generate 3 tag real, data1 to data3

And for the read area in slave PLC, come to Slave PLC and create new data block DataToMaster and generate 3 tag real, data1 to data3.

Generate read area and store area done, now we put into the GET module.

Right click on GET module, come to READ AREA, put DB number in slave PLC, DBx.DBx0.0

“0.0” here is the offset of data, here (open the DB) if we want to read from this data from0.0 we put 0.0, if we want read data from 4.0, we put 4.0

If we want to read 3 real data, we put here 3 and real.

Come to STORE AREA, put DB number in master PLC and DBx0.0

We want to store 3 real data, we put here 3 and real

So it’s done for GET module.

Now in order to let the GET module request continuously, we need to set and reset the bit REQ.

We add 1 command SR, output is GET_DB.REQ

This means whenever 1 request is done or have error, the bit REQ will be reseted

It’s done for GET module.

 

Step 8: we program for PUT module.

We do the same as GET module.

Step 9: After programming done, we compile.

In this project, I use PLCsim to simulate 2 PLCs.

Download

And Online: DataToSlave and DataFromMaster are same, means communication between 2 PLCs is successful.

For more detail, kindly watch this video: https://www.youtube.com/watch?v=btZXJMoNHUg&list=PLFZXAg2fI5PSYcbEJjC3GT6fJoy5rtANN&index=7

Relate Posts
Dear my colleagues, Today, I will start the series of sequence and phase PLC programming. Firstly what is sequence? Sequence...
Simatic PCS 7 is the DCS system of Siemens Picture 1: Simatic PCS 7 structure The first layer is OS...
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Shopping Cart