MPI communication between S7-200 and S7-300
MPI (Multipoint Interface) is a communication protocol used by Siemens internally. The physical layer is RS-485. S7 basic communication via MPI network, S7-300You can use the system functions X_GET and X_PUT to read and write S7-200 storage area can read and write 76 bytes of data at most, S7- 200 No need to write a communication program. Its advantage is to use the RS-485 communication interface that comes with plc, without adding hardware for communication. Programming is simple and easy to implement.
1. Communication parameter setting
Set CPU 224 in MPI network is 3. For the convenience of downloading and monitoring, the S7- The communication rate of 200, S7-300 and computer is set to 19.2 kbit/s. The system block needs to be downloaded to the CPU for the set parameters to take effect.
Connect CPU 315-2DP to MPI network, set the MPI station address to 2. Download the set parameters to CPU 315-2DP.
2. CPU 315-2DP reads and writes the programming of CPU 224’s V area #p#page title#e#
<FONT face="Times New Roman" in CPU 315-2DP Call SFC 68“X_PUT” in >OB35, put <FONT76 bytes of data from face=”Times New Roman”>DB 1 are sent to DB 1 of the communication partner DBB100~DBB175, namely CPU 224 ‘s VB100~VB175. Call SFC 67“X_GET“, read CPU 224< VB200~VB275 of /FONT> (i.e. DB 1 DBB200~DBB275), store them in DB 2. The time interval for executing OB35 is the default 100ms.
Below is the cyclic interrupt organization block of CPU 315-2DPOB35 program:
Segment 1: Change the DB1 is written to CPU 224#p#page title#e#VDistrict
CALL “X_PUT”
REQ :=TRUE :p>
CONT :=TRUE :p>
DEST_ID :=W#16 #3 //S7-200MPIaddress
VAR_ADDR:=P#DB1 .DBX100.0 BYTE 76 //S7-200VB100~VB175
SD :=P#DB1 .DBX0.0 BYTE 76 //The address area where the data to be sent by this station is stored
RET_VAL :=MW2
BUSY :=M0.1
Segment 2: Read CPU 224 V area data, save to DB 2 of this site
CALL “X_GET”
REQ :=TRUE
CONT :=TRUE
DEST_ID :=W#16 #3
#p#Page Title#e# VAR_ADDR:= P#DB1.DBX200.0 BYTE 76 //To read the of S7-200 VB200~VB275
RET_VAL :=MW4
BUSY :=M0.3
RD := P#DB2 .DBX0.0 BYTE 76 //The address area for saving the read data
In order to verify whether the communication is achieved, in the initialization program OB100 will data block DB 1 76 The word preset in the byte data sending area is W#16#3333, set DB 2The 76 byte data receiving area is reset to 0.
3. Program of CPU 224
In order to verify whether the communication is realized, in CPU 224 OB1, the data area VW204~VW274 is preset to 16#2222, will receive data area VW100~VW174 is cleared.
LD SM0.1
FILL #p#Page Title#e#16#2222, VW204, 38
FILL 16#0, VW100, 38
You can use CPU 315-2DP variable table and CPU 224‘s status table to monitor the memory areas participating in the communication.
When I did the experiment for the first time 1, it succeeded very smoothly. The general feeling is that as long as there is no problem with configuration and programming, communication is easy to achieve.