PLC is widely used in various control fields due to its high reliability, strong anti-interference ability, complete supporting facilities, perfect functions and strong adaptability. As a general industrial control computer, PLC is an industrial control equipment for industrial and mining enterprises. It uses ladder diagram symbols for programming, which is quite close to relay circuits and is accepted by the majority of engineering and technical personnel. However, in practical applications, how to program to improve the running speed of PLC programs is a question worthy of our consideration and research. 1 PLC working principle The working principle of PLC is basically the same as that of computer, that is, under the management of system program, user tasks are completed by running application programs. But the working methods of the two are different. Computers generally adopt the working method of waiting for commands, while PLC becomes a special machine after determining the work tasks and installing special programs. It adopts the cyclic scanning working method. System work task management and application program execution are completed by cyclic scanning. PLC has two basic working states, namely, running (RUN) and stopping (STOP). In these two states, the scanning process of PLC and the tasks to be completed are not the same, as shown in Figure 1. When the PLC is in the RUN working state, the time it takes to perform a scan operation is called the scan cycle. Its typical value is usually 1-100 microseconds, and the products of different PLC manufacturers are slightly different. The scan cycle consists of three parts: internal processing time, input/output processing execution time, and instruction execution time. Usually in a scan process, the time to execute instructions accounts for the vast majority, and the time to execute instructions is related to the length of the user program. The user program is compiled by the user according to the control requirements and consists of many PLC instructions. Different instructions correspond to different program steps. Taking the Mitsubishi FX2N series PLC as an example, the PLC\'s processing time for each program step is: basic instructions account for 0.741s/step, and functional instructions account for several hundred microseconds/step. There are many ways to compile programs to complete a control task. Therefore, choosing a reasonable and clever programming method can greatly improve the program running speed and ensure reliability. Several programming methods to improve the running speed of PLC programs 2.1 Control output by transferring data to bit element combinations In PLC application programming, there will be an output control program at the end, which is generally written using logic fetch and output instructions, as shown in Figure 2. In the program shown in Figure 2, the program step of logic fetch is 1, the program step of output is 2, and a total of 3 program steps are required to execute the above program. Under normal circumstances, the outputs to be controlled by PLC will not be a small number. For example, there are 8 outputs, and they must be output at the same time when the conditions are met. At this time, a total of 17 program steps are required to execute the program shown in Figure 2. If we use the combination of bit elements and the method of data transfer to complete the program shown in Figure 2, the program steps will be greatly reduced. In Mitsubishi PLC, components that only process ON/OFF states (such as X, Y, M and S) are called bit elements. However, bit elements can also be combined to process data. Bit element combinations are represented by Kn plus the first element number. Bit elements are combined into units in groups of 4 bits. For example, n in K YO is the number of groups. When n=1, K,Yo corresponds to Y3-Yo. When n=2, KZYo corresponds to Y7-Yo. By combining bit elements, bit elements can be processed in the same way as data. The function shown in the program of FIG2 can be completed in the way of transmitting data as shown in FIG3.
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore