1. Unified program structure
OB1: Main program;
OB100: Initialization program (no need for main program to call);
OB35: 100ms (modifiable) interrupt (no need for main program call), can call PID module;
OB80, OB82, OB85, OB86, OB87, OB121, OB122: Fault diagnosis module (no main program call required, no programming required);
FC1: System mode;
FC2: Input processing;
FC3: Output processing;
FC4: Runtime processing;
FC5: Stop processing;
FC6: Manual/automatic switching;
FC100: This is then used to create subroutines that can be called repeatedly;
FC105: Built-in analog input subroutine (can be called repeatedly);
FC106: Built-in analog output subroutine (can be called repeatedly).
Modbus communication (CP341): FB7: P_RCV_RK, FB8: P_SND_RK;
Communication CP340: FB2: P_RCV, FB3: P_SND;
Typical PID: Use FB41;
Temperature and humidity PID: using FB58;
If a program block overlaps with a system block, please avoid it.
2. Data Block
DB1: AI data, type: REAL, interface with host computer;
DB2: AO data, type: REAL, interface with host computer;
DB3: DI data, type: BOOL, interface with host computer;
DB4: DO data, type: BOOL, interface with host computer;
DB5: Device runtime and traffic accumulation, type: REAL, interface with host computer;
DB6: Alarm message, type: BOOL, interface with host computer;
DB7: Type: REAL, intermediate register;
DB8: Type: INT, intermediate register;
DB9: Type: WORD, intermediate register;
DB10: Type: BOOL, intermediate register;
DB11: This is used for communication with devices, such as MODBUS communication.
DB100: This will be used as the background data block when calling the FB block;
M region: also used as an intermediate variable.
3. DP slave station fault diagnosis
DP slave stations must perform fault diagnosis and fault alarms, which can be achieved using FB125.
II. Control Mode
1. System settings: Remote/Local/Manual buttons
1.1 Remote: The system can only be automatically started/stopped via a host computer. Local control of a single device is preferred. In program control mode, the device can be switched between manual and automatic operation via the host computer, and manual start/stop can be performed.
1.2 Local: The system can only be automatically started/stopped via the touch screen. Local control of a single device takes priority. In program control mode, the device can be switched between manual and automatic operation via the touch screen, and manual start/stop can be performed.
1.3 Manual: When in manual control, the host computer/touch screen is disabled, and the device can only be started/stopped manually.
2. Single device control
Each device must have a manual/automatic switching function and a start/stop function when using manual operation. When switching from automatic to manual operation, the device cannot be stopped; when switching from manual operation to automatic, the device's start/stop depends on the automatic program.
3. Single unit
(Pumps, fans and other large equipment) must be rotated after 24 hours of operation, and the operating time must be accumulated, unless the start/stop sequence is set by the host computer, in which case the operator shall set it himself;
III. Programming Skills
1. Program blocks should be made as detailed as possible for easy reading, and the control of the same type of device should be placed in one program block;
2. In special circumstances where programming languages are used, please use ladder diagrams in most cases for easier reading by others;
3. For frequently called subroutines, they can be made into submodules for frequent calls, such as: calculating the average of several numbers or the maximum value of several numbers;
4. The program must have comments, and variables and intermediate variables must be described to facilitate reading or future reference.
5. Perform program backups regularly, preferably using the format: project name + system name + current date;
6. The program is encrypted to prevent others from stealing it.
IV. Siemens PLCs are classified according to their control scale.
They can be divided into mainframes, mid-range computers, and minicomputers.
Siemens PLCS7-300 series
Siemens PLCS7-300 series
Miniature computer: Miniature computers typically have 256 control points, making them suitable for single-machine control or small system control.
Siemens minicomputers include the S7-200: processing speed 0.8 ~ 1.2ms ; 2k memory; 248 digital inputs; 35 analog inputs.
Medium-sized machines : Medium-sized machines typically have no more than 2048 control points . They can be used for direct control of equipment and can also monitor multiple downstream programmable logic controllers. They are suitable for medium or large-scale control systems.
Siemens S7-300 is a medium-sized computer with a processing speed of 0.8 ~ 1.2ms , 2k memory, 1024 digital inputs, 128 analog inputs, PROFIBUS network, industrial Ethernet, and MPI.
Mainframes: Mainframes typically have more than 2048 control points , enabling them to perform complex arithmetic operations.
Siemens PLCS7-400 series
It can also perform complex matrix operations. It can be used not only for direct control of equipment, but also for monitoring multiple downstream programmable logic controllers (PLCs).
Siemens mainframe computers include the S7-400: processing speed 0.3 ms/1k words;
512k memory; 12672 I/O points;