Speak with authority, quality is trustworthy.

PLC modular programming and structured programming

by:Coolmay     2020-07-22
Modular programming in OB1 to play the role of a main program, FC or FB control process of the different tasks, the equivalent of the main loop program subroutine. Modular programming is called to call blocks of data returned.

modular execution

modular programming in OB1 to play the role of a main program, FC or FB control process of the different tasks, the equivalent of the main loop program subroutine. Modular programming is called to call blocks of data returned.

modular programming instance

1. 1 - modular programming examples Liquid level monitor

, monitoring a slow process does not need to scan every time. If the process at regular intervals or according to the need for processing, process will be more effective. • in OB1 loop scanning processing, can according to certain cycle of liquid level monitor. Design methods:

, determine the part of the liquid level monitoring and their relationships;

, design the function of the required control task;

, planning from the OB call completion piece of program execution

process;

, each segment of block combined with text annotation and title. Solutions:

FC, set up a function, you can monitor and control task;

, build a OB, among them at regular intervals called block

Function) 。

2。 Modular programming instance 2

there are two electric motors, control pattern is the same, press the start button ( 1 is the I0 motor. 2 0, motor for I1. 0) Motor starting, running, Motor 1 for Q4. 2 0, motor for Q4. 1) ; Press the stop button ( 1 is the I0 motor. 1, motor 2 for I1. 1) Stop running, the motor.

:

this is a typical power way, by adopting the idea of modular programming, respectively in FC1 or FC2 write motor control procedures, in the main program OB1 in FC1 or FC2 calls.

structured programming Ø complex task decomposition into the process, function, or of some can reflect can be repeatedly used separately to solve small task, these tasks are represented by the corresponding program block;

Ø some block can be used to achieve the same or similar functions;

Ø caller can be all kinds of logical block, including user-written OB, FB, FC and SFB and SFC system;

Ø called block is OB outside the logical block;

Ø general data and code can be Shared.

structured programming advantages of structured programming:

the create and test a single task blocks can be independently of each other;

2, by using the parameter block can be designed to be flexible;

3 pieces can be according to the need in different places in different parameter data records are called;

4 in the library of upfront design, able to provide for special tasks 'reusable' block.

- structured programming examples Paint modulation

1 choice product additive, you need to decide which pot ingredients to add to the mix tank.

2 on the basis of the choice of the selector switch, tissue block calls the corresponding block, the parameters of the distribution of the current, control of mixing drum inflows. Design methods:

1. Determine which parts and operation can be applied to all the tank and the related control;

2。 Establish function or function block, complete the required control;

3。 Building block variable definition table, in order to address assignment to operate tank and control;

4。 According to the selected switch to design a program calls the function or function block. Solutions:

1. Create a function block or function control tank outflow;

2。 In order to establish the variable definitions related piece of table;

3。 Building a OB block to call function or function block according to the selector switch.

Chat Online
Chat Online
Chat Online inputting...
Sign in with: