S7-1200PLC motion control case introduction

Publisher:浊酒Latest update time:2024-03-07 Source: elecfansKeywords:S7-1200  PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In this case, we mainly learn the motion control function of 1200PLC. We use this three-axis device (as shown in Figure 1) to draw a square with a length and width of 50mm.


On the HMI (as shown in Figure 2), you can manually enable the axis, manually run the X-axis in the positive and negative directions, manually run the Y-axis in the positive and negative directions, manually run the Z-axis in the positive and negative directions, teach the reference position point, etc. In automatic mode, press the "Start" button to automatically draw a square with a length and width of 50 mm.

fe0df29e-6bf7-11ee-939d-92fbcf53809c.png

Programming ideas

1) You can set a reference point (as shown in Figure 3), and then calculate other position points in sequence.

2) Use absolute positioning instructions to reach the relevant position point.

fe174b1e-6bf7-11ee-939d-92fbcf53809c.png

Figure 3

2

Programming

1) Create a process object: Create the process object of the X axis (as shown in Figure 4 to Figure 10). The process objects of the Y axis and Z axis are similar and will not be described here.

fe1aeff8-6bf7-11ee-939d-92fbcf53809c.png

Figure 4

fe24bcd6-6bf7-11ee-939d-92fbcf53809c.png

Figure 5

fe3429dc-6bf7-11ee-939d-92fbcf53809c.png

Figure 6

fe440258-6bf7-11ee-939d-92fbcf53809c.png

Figure 7

fe5540f4-6bf7-11ee-939d-92fbcf53809c.png

Figure 8

fe5cb29e-6bf7-11ee-939d-92fbcf53809c.png

Fig. 9

fe6b4778-6bf7-11ee-939d-92fbcf53809c.png

Fig.10

2) Because our device has three axes, X, Y, and Z, and each axis has a position value, we can create a "UDT data type" to store the position values ​​of the three axes. The data type name of UDT is "Pos", as shown in Figure 11 and Figure 12.

fe76cfe4-6bf7-11ee-939d-92fbcf53809c.png

fe816c2e-6bf7-11ee-939d-92fbcf53809c.png

Figure 12 Figure 11

3) Manual control program (FC1), as shown in Figures 13 to 16, mainly implements the functions of axis enabling, jog control of three axes, homing of three axes, fault reset of three axes, etc.

fe948480-6bf7-11ee-939d-92fbcf53809c.png

Fig.13

fe9db1fe-6bf7-11ee-939d-92fbcf53809c.png

Fig.14

fea13d06-6bf7-11ee-939d-92fbcf53809c.png

Fig.15

fead5442-6bf7-11ee-939d-92fbcf53809c.png

Fig.16

4) Position calculation (FC2), to calculate the 4 position points of a square, you can use SCL language to write. When the value of "inst_Pos".HMI_SetBase" (derived from the button on the HMI) is 1, calculate the 4 position points. As shown in Figures 17 and 18,

feb72f9e-6bf7-11ee-939d-92fbcf53809c.png

Fig.17

fed94d68-6bf7-11ee-939d-92fbcf53809c.png

Fig.18

The calculated position values ​​are stored in array variables, as shown in Figure 19. The coordinate values ​​of the four points correspond to the four position values ​​of Figure 3.

fee28b58-6bf7-11ee-939d-92fbcf53809c.png

Fig.19

3) Main program

①Segment 1 mainly calls the manual control program. And after pressing the "inst_Pos".HMI_Start" button on the HMI, the status step MW36 is set to 1.

ff019e80-6bf7-11ee-939d-92fbcf53809c.png

② "inst_Pos".HMI_SetBase" is the button for setting the reference point on the touch screen. When this button is pressed, a reference point can be set, and a square is drawn according to the reference points. Since the calculated position values ​​of the third and fourth positions are opposite, the values ​​in the address are swapped. "inst_Pos".Pos[1] is given to "inst_Pos".FinalPos[1], "inst_Pos".Pos[2] is given to "inst_Pos".FinalPos[2], "inst_Pos".Pos[3] is given to "inst_Pos".FinalPos[4], and "inst_Pos".Pos[4] is given to "inst_Pos".FinalPos[3]. The starting point and the end point are the same point, so "inst_Pos".Pos[1] is given to "inst_Pos".FinalPos[5]. The "inst_Pos".FinalPos variable is shown in Figure 20.

ff13db72-6bf7-11ee-939d-92fbcf53809c.png

ff17a0f4-6bf7-11ee-939d-92fbcf53809c.png

Fig. 20

③Call the position calculation program

ff1c0838-6bf7-11ee-939d-92fbcf53809c.png

④Current position of the axis

ff310396-6bf7-11ee-939d-92fbcf53809c.png

⑤ Status step judgment, and then reach different positions

ff3a5392-6bf7-11ee-939d-92fbcf53809c.png

ff3e1d2e-6bf7-11ee-939d-92fbcf53809c.png

ff49075c-6bf7-11ee-939d-92fbcf53809c.png

ff5b15aa-6bf7-11ee-939d-92fbcf53809c.png

ff70a15e-6bf7-11ee-939d-92fbcf53809c.png

ff799e30-6bf7-11ee-939d-92fbcf53809c.png

ff8d36a2-6bf7-11ee-939d-92fbcf53809c.png


Keywords:S7-1200  PLC Reference address:S7-1200PLC motion control case introduction

Previous article:How to control permanent magnet synchronous motor?
Next article:Analysis of inverter failure caused by charging resistor and energy storage capacitor

Recommended ReadingLatest update time:2024-11-16 13:41

Mitsubishi PLC selection criteria
The number of input/output (I/O) points is the sum of the input signals and output signals that Mitsubishi PLC can accept, and is an important indicator for measuring the performance of Mitsubishi PLC. The more I/O points there are, the more external input devices and output devices can be connected, and the larger
[Embedded]
Explanation of all components of a typical PLC control cabinet
The Secret of PLC Control Cabinet PLC control cabinet refers to a complete set of control, an electrical cabinet that can realize the control of motors and switches. PLC control cabinet has overload, short circuit, phase loss protection and other functions. It has compact structure, stable operation,
[Embedded]
Mitsubishi FX series PLC connected to touch screen and configuration software Ethernet communication case
CHNet-FX Ethernet communication processor is designed to meet the increasing demand for factory equipment informatization (equipment network monitoring and production management). It is used for Ethernet data acquisition of Mitsubishi FX1N/1S/2N/3S/3G/3GC/3U/3UC series PLC (compatible with Huichuan and Hechuan PLC),
[Embedded]
Mitsubishi FX series PLC connected to touch screen and configuration software Ethernet communication case
PLC encryption technology and decryption method
PLC encryption technology is actually a developer's idea. As long as you understand the author's encryption idea, you can quickly decrypt it. In fact, in nature, whether it is PLC or elevator motherboard, as long as there is encryption, there will be a secret to crack it. The two are always a combination of spear an
[Embedded]
What is a variable? What are the components of a PLC variable?
variable Variables are variables used in programs and can have different values. Depending on the scope of application, variables can be divided into the following categories: ● Local variables: Local variables are available only to the block in which they are defined. ● PLC variables: PLC variables a
[Embedded]
What is a variable? What are the components of a PLC variable?
Wiring method and principle of sensor and PLC
Today, we will introduce the wiring method of sensors and PLCs, including 20 wiring diagrams. Isn’t it super rich? Let’s take a look together. 1 Overview The digital input interface of PLC is not complicated. In order to improve the anti-interference ability, the input interface of PLC uses photocoup
[Embedded]
Wiring method and principle of sensor and PLC
ST releases G3-PLC Hybrid Powerline and Wireless Converged Communications Certified Chipset
STMicroelectronics Releases G3-PLC Hybrid Powerline and Wireless Converged Communications Certified Chipset Turnkey solution based on the proven ST8500 programmable multiprotocol power line communication SoC and ultra-low power sub-GHz S2-LP RF transceiver China, June 2, 2021 - STMicroelectronics' ST8500 and S2
[Internet of Things]
ST releases G3-PLC Hybrid Powerline and Wireless Converged Communications Certified Chipset
Design of embedded PLC based on LPC2294 processor (I)
For more than 40 years, PLC has become the backbone of industrial control. Its functions are constantly improving, its application areas are constantly expanding, and its role in the advancement of industrial control technology and social development is immeasurable. With its high reliability and easy operation, PLC h
[Analog Electronics]
Design of embedded PLC based on LPC2294 processor (I)
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号