Logic method: it is to apply logic algebra to design programs in the method and form of logical combination. The theoretical basis of logic method is logic function, which is the logical combination of logic operation and, or and non. Therefore, in essence, PLC ladder program is the logical combination of and, or and non, which can also be expressed by logical function expression.

(1) Basic method: to design ladder diagram with logic method, a one-to-one correspondence must be established between logic function expression and ladder diagram, that is, in ladder diagram, normally open contact is represented by original variable (element) and normally closed contact is represented by inverse variable (element plus a small horizontal line). There are only two values for contact (variable) and coil (function), “1” and “0”. 1 indicates that the contact is connected or the coil is energized, and 0 indicates that the contact is disconnected or the coil is not energized. Contacts in series are represented by logical “and”, contacts in parallel are represented by logical “or”, and other complex contact combinations can be represented by combinatorial logic. Their corresponding relationship is shown in the table below.

(2) Design steps:

1) Define control tasks and contents by analyzing control requirements;

2) Determine the soft components of PLC (input signal, output signal, auxiliary relay m and timer T), and draw the external wiring diagram of PLC;

3) Convert the control tasks and requirements into logic functions (coils) and logic variables (contacts), analyze the logical relationship between contacts and coils, and list the truth table;

4) Write logical function expression;

5) Draw the ladder diagram according to the logic function expression;

6) Optimization ladder