PLC automatic program programming method

Publisher:XiangsiLatest update time:2024-08-22 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

[Introduction] The function of PLC automatic sequence is to control the equipment to work according to the pre-designed process flow. There are also several methods for writing the process of PLC automatic program. Let's make a detailed explanation below.


The first method: the reset method of the auxiliary relay


This method is the most primitive and simplest way of writing. For example, the first step is to set M0. After M0 is turned on, a certain result is controlled. After the result is achieved, M0 is reset, and then M1 is set, and the process control is carried out in sequence. This writing method is common to all PLCs.

292ea030-14d8-11ee-962d-dac502259ad0.jpg

Second method: using step numbering

Using integer variables as step numbers is easy to understand and maintain. Operations such as step increase, decrease, and jump are convenient, simple, and easy to understand. When resetting, just change the variable value to 0. When programming, please note that when the conditions of consecutive steps are true at the same time, the step number will increase continuously in one PLC cycle until the last non-conducting step instruction, and other programs triggered by the step number will not be executed. This situation is easy to miss during debugging.

29615b06-14d8-11ee-962d-dac502259ad0.png

The third type: GRAPH (sequential function flow chart language, also known as SFC)

This method is very similar to our equipment process flow chart, and is also the most intuitive program. It looks very clear what the first step is and what conditions are required to start the second step. Although the program looks very clear on the surface, the actual operation process of writing project programs is not simple. It takes time to become familiar with this writing method. In addition, this method is not universal for all PLCs (for example, Siemens S7-1200 does not support it, only S7-1500 supports it). In addition, it has high requirements on PLC performance and occupies a large amount of working memory.

2976068c-14d8-11ee-962d-dac502259ad0.jpg

Fourth: shift instruction method

This method uses the shift principle of shift instructions to achieve step control, such as Omron's SFT instruction, Mitsubishi's ROL, ROR, etc., and Siemens' shift instructions are similar. The difficulty of this method is to understand the working principle of the shift instruction, which is also common to all PLC programming.

Fifth: DECO decoding instruction method

Decoding instruction DECO: converts the integer to the corresponding position 1 in Dword, and when the step sequence changes, the PLC will definitely re-execute a scan cycle, and will not jump multiple steps continuously. It avoids the situation where the instructions triggered by the step sequence in the program are not executed. Jump and reset operations are simple to write. For example, Siemens S7-1200PLC can support DWORD decoding (32 bits), and S7-1500 can support LWORD decoding (64 bits).

298dd424-14d8-11ee-962d-dac502259ad0.png

Sixth: Method of assigning work and state variables

This method combines data transfer instructions with comparison instructions to achieve program flow step conversion. I personally think this method is the easiest to understand and the simplest to operate. It is recommended for beginners to try it. Of course, this method is also common to all PLCs. Set two variable words, state word and work word. The bit in the state word is used as the step mark, and the work word is used as the jump target step mark. When the condition corresponding to the step bit in the current step state word is met, the bit corresponding to the next step in the work word is triggered. Then, when the PLC sequentially scans to the transfer instruction, the value of the work word is assigned to the state word to complete the step jump. The advantage is that there is no set and reset operation. There is only one position 1 at the same time. When jumping, just set the corresponding position in the work word to 1. When resetting, clear the state word and work word to zero, and the program will automatically light up the first bit in the state word. When the step sequence is greater than 16, it can be changed to DWORD or the number of words can be increased to increase the step sequence.

29b1aa20-14d8-11ee-962d-dac502259ad0.jpg

29d09dfe-14d8-11ee-962d-dac502259ad0.png

Seventh: SCL programming method

More and more small PLCs support SCL language, which is a high-level programming language similar to PASCAL. Commonly used programming statements such as FOR, IF, WHILE, CASE, etc. can be combined to write very powerful algorithms and logics. More and more people use this writing method. Using SCL to design automatic programs mainly combines CASE and IF statements, and uses Step as the program number. If there are relatively long branches or parallel actions, multiple Step program steps are required, which will not be discussed here.

29e7db7c-14d8-11ee-962d-dac502259ad0.png


Keywords:PLC Reference address:PLC automatic program programming method

Previous article:Tips for Designing Efficient AC Motor Drive Systems
Next article:What is the difference between a variable frequency motor and an industrial frequency motor?

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号