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.
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.
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.
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Fig. 9
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.
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.
Fig.13
Fig.14
Fig.15
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,
Fig.17
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.
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.
② "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.
Fig. 20
③Call the position calculation program
④Current position of the axis
⑤ Status step judgment, and then reach different positions
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
- 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
- Find TI, NXP, ALTERA, XILINX, ST, Microchip factory stock chips
- Record the use of TM1668 driver
- Newbie help, ESP8266 program problem
- GaN Applications in RF and Electronics
- CC2530 Basic Experiment 1 I/O Experiment Code
- Qorvo Online Design Conference - Wi-Fi Architecture and Future Development of Wi-Fi Standards
- DC motor drive solution using TC118S domestic chip
- Inline instructions in TI DSP TMS320C66x study notes (c6x.h Chinese comments)
- [Zero-knowledge ESP8266 tutorial] Quick Start 19 Using NTP server to get network time
- [GD32E503 Review] How to Play with GD32E503-Environment Construction