As the core of the industrial field, PLC is widely used in many products. In-depth understanding of the use and solution knowledge will greatly promote the promotion and service improvement of PLC. This article selects ladder diagram as the programming language in terms of hardware and software. This article selects several problems that are prone to occur during the use of PLC and analyzes the solutions.
The control mode of PLC belongs to stored program control. Its control function is realized by the program stored in the memory. If the control function needs to be modified, it is only necessary to change the control program, which realizes the software control. The advantage of programmable controller lies in the word "can". From the software point of view, its control program can be edited and modified; from the hardware point of view, its external device configuration is variable. The focus of building a PLC control system is the compilation of the control program, but the selection of external devices will also affect the compilation of the program. Therefore, when designing the program, it should be combined with actual needs, and hardware and software should be considered comprehensively.
1. Selection of external input devices and use of PLC input relays
1. Collection of external input signals
The external devices of PLC mainly refer to the input and output devices in the control system, among which the input devices are the main electrical appliances that send various control signals to the system. When writing the control program, you must pay attention to whether the external input device uses normally open or normally closed contacts, and compile the program based on this. Otherwise, control errors are likely to occur.
There is an input relay area dedicated to input status storage in the PLC's internal memory. The status of each input device (switch, button, travel switch or sensor signal) is stored in this area via the input interface circuit. Each input relay can store an input device status. The "relay" used in the PLC is not a physical relay, but a "soft relay", which can provide countless normally open and normally closed contacts for programming. Each "soft relay" corresponds only to one bit in the PLC storage unit. If the bit state is "1", it means that the "soft relay coil" is energized, and all the contacts of the relay in the program are activated. As a device for the PLC to receive external master command signals, the input relay is connected to the external input device through wiring, and its "coil" state can only be driven by external input signals.
The input device is the normally closed contact of button SB0, and the coil state of input relay X0 depends on the state of SB0. When the button is not pressed, the coil state of input relay X0 is "1" (power-on state), and all X0 contacts in the program are activated, that is, the normally open contact is connected and the normally closed contact is disconnected; if the button is pressed, the coil state of input relay X0 is "0" (power-off state), and all X0 contacts in the program return to normal. If the input device connected to the input relay is the normally open contact of button SB0, the situation is exactly the opposite: when the button is not pressed, the coil state of input relay X0 is "0" (power-off state), and all X0 contacts in the program do not act; if the button is pressed, the coil state of input relay X0 is "1" (power-on state), and all X0 contacts in the program act.
2. The parking button uses a normally closed type
Since the PLC only determines the on/off status of the contacts in its memory when running the program, and does not directly identify the external device, the selection of external devices is closely related to the contact type in the program when programming. This is a problem that is easy to occur when programming PLCs in accordance with the electrical control schematic diagram. The most typical example is the parking control in the basic control - "start, stop and protect control".
In the start-stop-protection control system, button SB0 is used for parking control, so its normally closed contact is connected in series with the control circuit. SB1 is the start button, and its normally open contact is used. If the same device is used (i.e., SB0 for parking uses a normally closed contact, and SB1 for starting uses a normally open contact), and a PLC is used for this control, a ladder diagram program needs to be programmed.
3. The parking button should be normally open.
If you want to compile a ladder diagram program that conforms to our usual reading habits), when selecting an external parking device, you need to connect the normally open contact of button SB0 to X0.
The contact type used for the stop signal X0 in the program is different, and the reason is that the contact type of the external stop button connected to the input relay X0 is different. The ladder diagram program shown in Figure 4 is more in line with our reading habits and is easier to analyze its logical control function. Therefore, in the PLC control system, external switches and buttons are generally normally open, whether used for starting or stopping. This is a problem that needs special attention when using PLC.
2. PLC "serial" operation mode and control program compilation
One of the important differences between PLC and relay contactor control is the different working methods. The relay contactor control system works in a "parallel" mode, that is, it works in a simultaneous execution mode. As long as a current path is formed, several electrical appliances may operate at the same time. PLC works in a "serial" mode. When PLC executes the program in a loop, it performs logical operations from top to bottom in the order in which the statements are written, and the results of the previous logical operations will affect the results of the logical operations of the following statements. Therefore, when programming ladder diagrams, the position of each statement will also have a key impact on the control function. For example: X0 is connected 3 times, Y3 is connected, X0 is connected again once, and Y3 is disconnected. X0 is connected 3 times, and Y3 is disconnected the moment it is connected.
In the above two programs, the logical conditions before output Y3, counter CTl02 and internal general relay R0 are the same, only the position of the statement where counter CTl02 is located has changed, and the running results of the two programs are completely different. This is because the way CTl02 affects output Y3 has changed. When executing the first program, the state of output Y3 will be judged first, and then the state of CTl02 will be judged. The state change of CTl02 can only affect Y3 in the next scan cycle; when executing the second program, the state of CTl02 will be judged first, and then the state of output Y3 will be judged. The state change of CTl02 will directly affect the state of Y3 in this scan cycle.
From the above discussion, it can be concluded that since PLC adopts "serial" working mode, even if it is the same component, its working state will be different if it is in a different position in the ladder diagram. Therefore, when using the ladder diagram to compile the control program, the control task should be fully analyzed and the position of each programming component should be reasonably arranged to achieve more accurate control.
3. PLC programming elements
The various functions of PLC are mainly realized by running the control program. When compiling a program, it is necessary to use the programming elements (i.e. soft elements) provided by the PLC reasonably. There are two commonly used programming elements in FPO type PLC: bit elements (bit) and word elements (word). The bit element is actually a binary bit unit provided by the PLC memory area, also known as a soft relay, which is mainly used as a programming element for basic sequential instructions, such as input relay Xn, output relay Yn, internal general relay Rn, timer (counter), etc. The way it participates in control is mainly to change the on and off state of the corresponding contact to affect the logical operation result, that is, the output.
A word element is a word unit (16 bits) in the PLC memory area, which is mainly used as a programming element for functional instructions and advanced instructions, and is usually used to store data, such as data register DTn, timer (counter) setting value SVn, elapsed value EVn, etc. Word elements have no contacts and usually participate in control with their overall content.
It is worth noting that each bit in the input (X) area, output (Y) area and internal general (R) area in the memory can be used as a bit element, and every 16 bits can constitute a word element. For example, WRIO is a word element composed of 16 bit elements R100~R10F. Once the content in the word element changes, the status of these 16 bits will also change. WR0 is the word element, which is the programming element of the left shift instruction SR, and Y0 is the coil of the output soft relay. X0, X1, X2, and X3 are the contacts of the input soft relay. Among them, the R4 contact in step 4 is the normally open contact of the bit element R4, and the bit element R4 is a bit in the word element WR0, so its state is limited by the shift result of WR0.
4. Programming method of sequential control with multiple steps and same output
Sequential control is a common type of control task in production sites, and step instructions are dedicated to sequential control in the PLC instruction library. When programming step instructions, the program is divided into independent program segments according to the process flow. When executing, the CPU strictly follows the ladder diagram programming sequence. The next program segment can only be activated after the previous program segment is executed, and the previous program segment is reset before the next program segment is executed. In addition, the output used in each program segment is not allowed to be repeated in terms of syntax. This brings certain difficulties when solving the situation where there are multiple steps with the same output in the sequential control task. This problem can be easily solved with the help of internal general relays.
Previous article:PLC outputs random numbers between 0 and 100
Next article:Steps to create SCL function blocks in Siemens TIA Portal
Recommended ReadingLatest update time:2024-11-16 09:36
- 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
- Compensation Method for High-Precision Temperature Measurement Using MSP430 Microcontroller
- [Review of Arteli Development Board AT32F421] + Raising a Watchdog
- Let's talk about five cents and share your experience in voltage regulation circuit design
- Share: A brief analysis of the access control system using RFID technology
- How does this circuit achieve precise voltage regulation?
- MicropyCli - Micropython project management automation
- 【AIoT Smart Smoke Detection System】System Design Overview
- Doping of semiconductors from the perspective of energy levels
- EEWORLD University - HDMI 2.1 Design and Testing Update
- Design of breathing light based on FPGA