This article takes one CPU1215C (6ES7215-1AG40-0AB0) and one S7-200SMART PLC as an example to introduce the S7 communication between them.
Hardware:
S7-1200CPU
S7-200 SMART CPU (firmware V2.0)
PC (with Ethernet card)
TP Ethernet cable
Software:
TIAV16
STEP 7 Micro/WIN SMART V2.1
Completed communication tasks:
The S7-1200 sends 200 bytes in the communication data area DB1 to the VB data area of the S7-200SMART.
S7-1200 reads the VB data area in S7-200SMART and stores it in the data area DB2 of S7-1200.
S7-1200 hardware configuration and network configuration
1 Use TIAV16 software to create a new project, add an S7-1200 station and assign it a network and IP address, as shown in Figure 1-1.
Figure 1-1 Adding S7-1200 station in Botu software
2. Add a new connection for S7-1200CPU in the network view of TIA V16 software, as shown in Figure 1-2:
Figure 1-2 S7-1200 adding a new connection
In the pop-up "Create New Connection" dialog box, select "Unspecified", and then click the "Add" button to add a new connection, as shown in Figure 1-3.
Figure 1-3 Selecting an unspecified connection
You need to specify the IP address and TSAP of the connection partner for the newly created connection. The setting method is shown in Figure 1-4 and Figure 1-5.
Note: TSAP on the S7-200SMART side can only be set to 03.00 or 03.01.
Figure 1-4 Setting the connection partner IP address
Figure 1-5 Setting the TSAP address of the connection partner
TIA software program programming
1. Create a send data block DB1 (similar to the receive area data block DB2). The data block is defined as an array of 200 bytes and the "Optimized block access" option needs to be cancelled in the properties of the data block, as shown in Figure 1-6.
Figure 1-6 Creating a data block and canceling optimized access
2. After the send data block and the receive data block are created, you can call the PUT/GET instruction in OB1 to perform S7 communication, as shown in Figure 1-7.
Figure 1-7 Calling PUT/GET instructions
Table 1. PUT instruction parameter description
CALL "PUT" | , %DB3 | //Call PUT and use background DB block: DB3 |
REQ | :=%M0.0 | //The rising edge triggers the call of the program block |
ID | :=W#16#0100 | //The connection number should be consistent with the connection configuration. The connection number when creating the connection is shown in Figure 1. Mark 7 |
DONE | :=%M2.0 | // When it is 1, the sending is completed |
ERROR | :=%M2.1 | // When it is 1, a fault occurs |
STATUS | :=%MW4 | // Status code |
ADDR_1 | :=P#DB1.DBX0.0 BYTE 200 | // Address sent to the communication partner data area, corresponding to S7-200 SMART VB0-VB199 |
SD_1 | :=P#DB1.DBX0.0 BYTE 200 | // Local send data area |
Table 2. GET command parameter description
CALL "GET" | , %DB4 | //Call GET, use background DB block: DB4 |
REQ | :=%M0.1 | //System clock 2 second pulse |
ID | :=W#16#0100 | //The connection number should be consistent with the connection configuration. The connection number when creating the connection is shown in Figure 1. Mark 7 |
NDR | :=%M2.2 | //When it is 1, new data is received |
ERROR | :=%M2.3 | //When it is 1, a fault occurs |
STATUS | :=%MW6 | //Status code |
ADDR_1 | :=P#DB1.DBX200.0 BYTE 200 | //The address to read data from the communication partner data area, corresponding to S7-200 SMART VB200-VB399 |
RD_1 | :=P#DB2.DBX0.0 BYTE 200 | //Local receiving data address |
Based on the above steps, the programming of the S7-1200 hardware and software has been completed. Downloading only requires downloading the program to the S7-1200PLC.
Condition Monitoring
1. Connection status monitoring
The successful establishment of the S7 connection is the basis for calling the PUT/GET instruction. Only after the S7 connection is successfully established can the PUT/GET instruction be executed correctly.
In the network view of the TIA software, switch the software to online mode to monitor the S7 connection status, as shown in Figure 1-8.
Figure 1-8 Monitoring S7 connection status
After the S7 connection is successfully established, the S7-1200 triggers the PUT/GET instruction. Through the TIA software monitoring table and the STEP7 Micro/WIN SMART software status table, you can monitor whether the data communication is normal.
Note: The V area in S7-200SMART corresponds to DB1, that is, the communication partner data area ADDR_1=P#DB1.DBX0.0BYTE 200 used in the PUT instruction corresponds to VB0~VB199 in S7-200SMART.
In this document, S7-200SMART acts as the S7 communication server, occupying the server connection resources of the S7-200SMART PLC. The S7-200SMART PLC itself does not need to write a communication program.
Another method for S7-1200 to communicate with S7-200SMART S7 is to use S7-200SMART PLC as the client and S7-1200 as the server. This method requires S7-200SMART to call PUT/GET instructions, and the S7-1200 side does not need to write a communication program.
Previous article:Three control methods of PLC servo motor
Next article:Research on the method of confirming the position of brushless motor Hall sensor and motor rotation direction
Recommended ReadingLatest update time:2024-11-16 12:58
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- National Undergraduate Electronic Design Competition Module Design Series (II)
- MSP430 interrupt mechanism
- The internal matching drive amplifier is actually an internal two-stage process as shown below:
- CC2540 Power Settings
- How do I convert the differential signal from the fiber optic transceiver into a video signal (CVBS)?
- I'd like to ask for your advice, is there any cheap solution to remotely control LED advertising screens via the internet?
- Class-D amplifier TAS5731M power-on timing analysis
- Meet at the MPS Core Cloud Exhibition Hall, challenge yourself with wisdom and courage, and win exclusive gifts!
- 【Silicon Labs Development Kit Review】+PG22 Hardware Resources
- "Play Board" + Shared Bicycle Control Panel-Hardware Modification