Getting Started with Siemens PLC-PLC Introduction

 

The full name of PLC is Programmable Logic Controller (Programmable Logic Controller), a digital operation controller with a microprocessor for automatic control , which can load control instructions into memory at any time for storage and execution. PLC is composed of functional units such as CPU , instruction and data memory, input/output interface, power supply, and digital-to-analog conversion .

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

Let's make a comparison with a single-chip microcomputer: a single-chip microcomputer (Single-Chip Microcomputer, full name: single-chip microcomputer) is a kind of central processing unit CPU with data processing capabilities, random access memory RAM, read-only memory , etc. ROM, a variety of I/O ports and interrupt systems, timers/counters and other functions (may also include analog multiplexers, A/D converters and other circuits) integrated into a small and complete micro computer system.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

From the above description, PLC and microcontroller are very similar. They are all programmable controllers with computer systems. But their fields of application and usage are quite different. PLC is biased in the field of industrial automation, such as production lines, industrial robots, CNC machine tools, etc., while single-chip microcomputers are biased in life, such as household appliances.

From the appearance point of view, the single-chip microcomputer is a chip, and the smallest system of the single-chip microcomputer is composed of modules such as a crystal oscillator circuit and a reset circuit. The PLC looks like a box from the outside, with a large size, and all its internal components are packaged inside. You can’t see any electronic components such as resistors and capacitors from the outside, only a lot of terminals and indicator lights. This also enables PLC to operate more stably in harsh environments and has stronger anti-interference ability. Of course, the price of PLC is also much higher than that of single-chip microcomputer. The price of a PLC is 1,000 yuan, which is why PLC is not used in ordinary household appliances.

Secondly, their working voltages are also different. The working voltage of single-chip microcomputer is generally DC 5V, while the working voltage of PLC is DC 24V or AC 220V. Therefore, a microcontroller is more like an electronic product, and a PLC is more like an electrical device. Similar to single-chip microcomputers, PLC output ports generally do not directly drive loads, and generally control the main circuit indirectly by controlling relays or contactors.

In fact, we can regard the inside of PLC as a single-chip microcomputer, but PLC has carried out secondary development on the basis of single-chip microcomputer, which has greatly changed its use method and derived a set of independent and more convenient programming methods. At the same time, it also makes its supporting equipment more standardized.

       Currently mainstream PLC brands include Siemens (Germany), Mitsubishi (Japan), Omron (Japan), Schneider (France), etc. Domestic brands are also on the rise, such as Inovance, Xinjie, and Hechuan, which also have a good market share. Currently, Siemens still has the highest market share.

         Different brands use different programming software, and even different models of PLCs of the same brand use different software. For example, Siemens PLC has four programming software, namely STEP7 Microwin ( S7-200 ), STEP 7- Micro/WIN SMART (a programming software specially developed for S7-200 SMART), STEP7 V5.5 ( S7-300 , S7-400, ET200), STEP 7 V11 (S7-300, S7-400, S7-1500, S7-1200).

PLC programming language: PLC has five standard programming languages: ladder diagram language (LD), instruction list language (IL), function block language (FBD), sequential function flow chart language (SFC), and structured textual language (ST). Ladder diagrams are the easiest to learn for those with a basic circuit background because they are programmed graphically. The ladder diagram corresponds to the electrical operation schematic diagram, which is intuitive and corresponding; it is consistent with the original relay control, and is easy for electrical designers to grasp. The figure below is a simple PLC coil self-locking ladder diagram (Siemens), you can find that its logic relationship and circuit principle are very similar.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

Next, Siemens S7-1200 will be used as an example to introduce the mechanism of PLC and its programming environment.

S7-1200 is a new generation of modular small PLC of Siemens. First look at the structure of this PLC:

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

The main body of the PLC is the middle CPU. Although it is a CPU, it actually integrates a processor, input and output ports, and memory, and can work alone. The S7-1200 has three models of CPUs to choose from, and each model has three versions, each version corresponds to a different power supply/input/output method, which is very flexible in use. Some of its parameters are as follows (detailed parameters can be downloaded from the Siemens official website product manual):

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

 

In some simple control scenarios, a single CPU is sufficient, and it has a certain number of I/O ports. For example, the CPU 1214C in the above table has 14 input ports and 10 output ports. But in some cases, such as insufficient CPU input and output ports, or need to use analog input and output, then an expansion module is needed.

The first is the signal board (SB), you can see the front structure diagram, it is installed on the front of the CPU, you only need to open the front cover of the CPU to install the signal board, but there is only one signal board installation slot, so S7- The 1200 can only expand one signal board at most. In addition, this mounting slot can also install RS-458 interface and battery board.

If the input and output ports of the signal board are installed, the signal module (SM) is needed. The signal module is installed on the right side of the CPU and is connected to the CPU through copper pins. Compared with the signal board, multiple signal modules can be expanded at the same time. Looking at the above table, CPU 1214C can expand up to 8 signal modules. You can imagine the scene where 8 signal modules are connected together. With the signal module, you don't have to worry about the lack of input and output ports anymore (but the signal module needs to occupy the installation space, the more expansion, the more space it takes up).

There are many types of signal boards and signal modules to choose from, and the number of input and output points, analog and digital values ​​of different models are also different. For the specific model, please refer to the S7-1200 user manual, so I won’t go into details here.

There is also a communication module (CM), which is installed on the left side of the CPU, and the S7-1200 can expand up to 3 communication modules. It is a bridge between the CPU and the network.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

PROFINET interface: This interface is used for programming, HMI communication and communication between PLCs. In addition, it supports communication with third-party devices via an open Ethernet protocol. When the program is downloaded, the interface is connected to the Ethernet interface of the computer through a network cable. This interface can also be used to connect to the compact series panel or communicate with other PLCs via Ethernet.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

      Let's take a look at the wiring diagram of the PLC again. We talked about the CPU model and version above. The S7-1200 CPU has 3 versions, namely DC/DC/DC, AC/DC/RLY, and DC/DC/RLY. The version number has 3 parameters, corresponding to the power supply voltage/input voltage/output voltage, AC means AC 220V, DC means DC 24V, RLY means relay output (the relay output is controlled by 220V AC). It can be found that the PLC is different from the single-chip microcomputer here. The input and output voltage of the single-chip microcomputer is consistent with the power supply voltage, but the power supply voltage, input voltage and output voltage of the PLC are not the same, so the PLC may use two power supplies at the same time. Below are the wiring diagrams of the 3 versions of CPU 1214C.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

The other two CPUs are the same as the 1214C, but the number of ports is different, so I won’t go into details here.

Then introduce the programming software of S7-1200.

The software we need to use is TIA Portal (Botu) software, which can be downloaded and installed in the "Software Manager" (the installation of this software is cumbersome, you can follow the installation steps step by step to avoid installation failure). TIA Portal integrates programming, simulation and HMI interface design, and is very convenient to use. Here we are using the V15 version. It should be noted that different versions of Portal are not compatible, which is really maddening.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

Let's take a look at the software interface first. The figure below shows the PLC configuration. The added devices and their connections can be viewed here:

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

The PLC ladder diagram is very similar to the circuit. They all have a series-parallel structure, self-locking, interlocking, etc., but there are differences. On the far left of the ladder diagram, there is a vertical line, which we call energy flow (it can be compared to the source of a river). Judging whether a certain component of the ladder diagram is working, that is, whether the component has energy flow into it (visually speaking: whether the water at the source of the river flows into the component), which is similar to the current (except that the current flow needs to be closed loop, the trapezoidal diagram is not required), and an open switch can isolate the inflow of energy flow.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

The following are the basic instructions of the ladder diagram (timer, counter, shift and other instructions will be introduced later):
-| |- normally open contact
 -|/|- normally closed contact
XOR bit exclusive OR
-|NOT|- signal Flow Reverse
 - ( ) Output Coil
- (S) Coil Set

-(R) Coil Reset
 RS Reset Set Flip-Flop
 RS Set Reset Flip-Flop
 -(N)- Falling Edge Detection
 -(P)- Rising Edge Detection

It should be noted that the ladder diagram cannot start with a coil, nor can two coils be connected in series.

All PLC variables can be found in the PLC variable table, including their data types, corresponding addresses, and names.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

 The following is the HMI man-machine interface development interface, where you can use your imagination to build various pictures and animations. This software can also simulate the man-machine interface, which is very convenient.

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzU1MjAzMjQ2,size_16,color_FFFFFF,t_70

As shown in the figure above, the button with serial number 1 is the download button. After the ladder diagram is written, click this button to download the program to the PLC; serial number 2 is the opposite of download, it can download the program in the PLC to the computer; This button can use the PLCSIM component to perform ladder diagram simulation, and its specific use will be introduced with a special example next time.

The most important thing in learning PLC is programming, and the most important thing in programming is program thinking. It is a bit uncomfortable to learn ladder diagram at the beginning, because its program logic is quite different from C language and assembly language. You have to jump out of the logical thinking of C language and use the logical thinking of circuit to understand, and you will find that the ladder diagram is actually very simple.

It is recommended to try to understand the ladder diagram first, find some examples, first clarify the overall structure, and then analyze the function of each component; then try to modify the existing program under different control requirements; finally try to write the program with your own ideas. If you can write some programs by yourself and have a clear idea of ​​the idea, it means that you have understood the meaning of the ladder diagram.

Of course, PLC not only needs to be able to program, but also to learn the application of PLC in inverters, servers, PID control, etc.

 

 

This article is purely personal understanding, if there is an error, please also point out

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_55203246/article/details/114880704