# PLC five programming languages

1. Sequential Function Chart (SFC)

This is a graphical language on top of other programming languages for programming sequential control programs, which are described in detail in Chapter 4. Sequential function diagrams provide a graphical method of organizing programs that can be nested in other languages in sequential function diagrams. Steps, transitions, and actions are the three main components in a sequential function diagram (see Figure 3–2). The sequential function diagram is used to describe the function of the digital control system, according to which it is easy to draw the sequential control ladder program.

Ladder diagram is the most used PLC graphics programming language. The ladder diagram is similar to the circuit diagram of the relay control system. It is easy to understand and easy to understand. It is easy to be mastered by the electrical personnel familiar with the relay control in the factory. It is especially suitable for switching logic control. Figure 3–3 and Figure 3–4 represent the same logical relationship in three programming languages ​​of the Siemens S7–200 series PLC. The instruction list is called the statement list in the Siemens manual.

Ladder diagrams consist of contacts, coils, and application instructions. The contacts represent logic input conditions such as external switches, buttons, and internal conditions. The coil usually represents the logic output and is used to control external indicators, AC contactors, and internal output flags.

When analyzing the logic relationship in the ladder diagram, in order to borrow the analysis method of the relay circuit diagram, it can be imagined that there is a left-right and negative-negative DC power supply voltage between the left and right vertical busbars (sometimes the vertical busbar on the right side is omitted). When the contacts of I0.1 and I0.2 are turned on in 3–3, or when the contacts of M0.3 and I0.2 are turned on, there is an imaginary “power flow” flowing through Q1.1. Coil. Using the concept of energy flow can help us better understand and analyze ladder diagrams, and the flow of energy can only flow from left to right.

3. Function block diagram (FBD)

This is a programming language similar to digital logic gates, which is easy for people with a digital circuit foundation. The programming language uses a box similar to the gate, OR gate to represent the logical operation relationship. The left side of the box is the input variable of the logical operation, the right side is the output variable, and the small circle on the input and output ends the “non” operation. The boxes are connected by “wires” and the signals flow from left to right. The control logic in Figure 3–4 is the same as in Figure 3–3. Some micro PLC modules (such as Siemens’ “LOGO!” logic module) use the function block diagram language. In addition, few people in China use the function block diagram language.

4. Instruction list (IL)

The PLC instruction is a mnemonic expression similar to the instruction in the assembly language of the microcomputer. The program consisting of instructions is called an Instruction List program. The instruction list program is difficult to read, and the logical relationship is difficult to see at a glance, so the ladder language is generally used in design. If you are using a handheld programmer, you must convert the ladder diagram to a command list before writing to the PLC. In the user program memory, the instructions are arranged in the order of the step numbers.

5. Structure text (ST)

Structured Text (ST) is a specialized high-level programming language created for the IEC61131–3 standard. Compared with ladder diagrams, it can perform complex mathematical operations, and the program written is very simple and compact.

In addition to providing several programming languages for users to choose from, the standard also allows programmers to use multiple programming languages in the same program, allowing programmers to choose different languages to suit a particular job.