Siemens PLC200smart (1)

Exterior

Take Siemens' entry-level PLC as an example to illustrate the working principle and structure of PLC;

1. Siemens SMART200PLC will increase or decrease in function due to different models, such as the number of IO points, the number of pulse outputs (the number of servos that can be controlled), etc. will be different;

2. All models have an Ethernet port, which can be connected to the switch to expand the number of connections to the upper computer and the lower computer. For example, it is necessary to connect 3 SMART200PLCs and two touch screens at the same time;

3. Of course, if you only need a PLC and a touch screen, you can connect directly with a network cable;

 

Expansion:

Ethernet communication: All Siemens SMART PLCs are equipped with Ethernet ports, support Siemens S7 protocol, and effectively support the following connections:

1. It can be used as a program download port;

2. Communicate with SMART LINE touch screen, support up to 8 units;

3. Communicate with multiple Ethernet devices through the switch (such as industrial computer, etc.) to achieve rapid data interaction;

4. For communication with SMART PLC, we need to pay attention here. The communication between them is best to set up a master station, PLC1 will be the middleman, communicate with all PLCs, and transmit data, so that there will be no problems in communication. Read and write operations between each PLC, communication is prone to instability, and the readability of the program will be greatly reduced; of course, the number of communications here is also limited, it is impossible to communicate with an unlimited number of PLCs, generally the most 8;

 

 

Serial communication:

Each SMART200PLC module has an RS485 interface, which is generally used to communicate with inverters, and the other is to communicate with the touch screen;

1. Inverter communication, because most inverters do not have an Ethernet communication port, when a large number of inverters need to be controlled, communication can save a lot of time and wiring, and most inverters support ModbusRTU communication (if you are not familiar with communication , You can refer to my blog, there is an article dedicated to communication knowledge);

2. Most of the touch screens use a network cable to communicate with the PLC. In fact, there is also a serial port on the touch screen. You only need to connect the serial port on the touch screen to the serial port on the PLC. This has the same function as the network port;

 

Siemens SMARTPLC also uses SD card for firmware update and program download. Of course, Siemens only provides one more method;

It should be noted that the SD card has an important function, which is very practical, which is to restore the factory settings;

 

Principle description

CPU control logic

As shown below

1. Press the start button, the CPU reads the input status;

2. The program stored in the CPU uses these inputs to evaluate the control logic;

3. The program runs and the CPU updates the data;

4. The CPU writes the data into the output, and the motor starts;

 

Scan cycle: The CPU repeatedly executes a series of tasks. The cyclic execution of this task is called the scan cycle; whether the user program is executed or not depends on whether the CPU is in STOP mode or RUN mode. In RUN mode, the program is executed, and in STOP mode, Do not execute the program;

The program is executed step by step. When we write the program, there will be many lines. 100 lines or 1000 lines are possible. The program cannot execute all lines at the same time. The CPU scans and executes the program line by line according to the scan cycle. As long as the CPU is in RUN mode, The CPU will keep scanning, from top to bottom, after the scan is completed, from top to bottom, the cycle continues;

The specific scanning method is as follows:

1. Read input: CPU copies the state of the physical input to the process image input register, if there is an input, it is 1, and if there is no input, it is 0;

2. Execute the control logic in the program, the CPU executes the program instructions and stores the values ​​in different storage areas;

3. To process any communication request, the CPU performs all tasks required for communication;

4. Perform CPU self-check diagnosis, CPU ensure that firmware, program memory and all expansion modules are working correctly;

5. Write output: write the value stored in the process image input register to the physical output;

 

Expansion:

Read input:

1. Digital input: At the beginning of each scan cycle, the current value of the digital input will be read, and then the value will be written to the process image register;

2. Analog input: The CPU will not read the analog input value during the normal scan cycle, but when the program accesses the analog input, the CPU will immediately read the analog value from the device;

 

Write output:

1. Digital output: At the end of the scan cycle, the CPU writes the value stored in the process image output register to the digital output;

2. Analog output: The CPU will not write the analog output value during the normal scan cycle. When the program accesses the analog output value, the CPU will write the analog output immediately;

 

Execute user program:

The scan cycle is divided into reading input stage, executing user program stage and output stage;

In the stage of executing the user program, the CPU executes the main program, starting from the first instruction and continuing to execute to the last instruction. In the main program or during the execution of the interrupt program, the immediate I/O instruction can be used to immediately access the input and output (the later instructions will be explained in detail in the PLC programming);

If the program uses a subprogram, the subprogram is stored as a part of the program, and the subprogram is executed when the main program, another subprogram, or the interrupt program calls the subprogram. When calling from the main program, the nesting depth of subprograms can be 8 levels, that is, the main program calls subprogram 1, subprogram 1 is calling subprogram 2, and subprogram 2 is calling subprogram 3, and so on. When calling from the interrupt program, the nesting depth loses 4 levels (about the interrupt program, it will be explained in detail in the later PLC programming);

 

Guess you like

Origin blog.csdn.net/weixin_39829336/article/details/114061384