F UNCTION B LOCK D IAGRAM (FBD)

F UNCTION B LOCK D IAGRAM (FBD)

Function block diagram (FBD) is a graphical language that allows the user to program elements (e.g., PLC function blocks) in such a way that they appear to be wired together like electrical circuits. Figure 10-5 illustrates this type of function block diagram configuration. Some IEC 1131-3 systems use logic symbols to represent the function blocks. Note that the output logic of the block in Figure 10-5 does not incorporate an output coil because the output is represented by the variable assigned to the output of the block. This

Output variable of timer (Dwell) becomes the input to the set/reset block

LS_Stop

LS_OK

Dwell

Cont_Cycle

TMR

Q Set/Reset

Time_Value

Reset_Sys

Stop_Cycle

POS_RT

Move_Up OR

AT_TOP

Section of a control program using a timer, set/reset, AND, and OR function blocks

Figure 10-5. Function block diagram language.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

variable can be used throughout the program in other instructions and as a control output through the address mapping performed during variable declaration. The user may still choose to use an output coil representation if desired; however, it will only be allowed in the last (right-most) block. The FBD language uses both standard and vendor-specified function blocks. The block functions typically used with the IEC 1131 standard include, for the most part, the block functions discussed in Chapter 9.

In addition to standard and vendor-specified functions, the IEC 1131-3 allows users to “build” their own function blocks according to control program requirements. This is referred to as encapsulating a block function. The advantage of creating user-defined blocks is that they can be built using other function blocks, instruction list, or structured text programming with or without ladder diagram instructions. This allows great flexibility in function block programming. Encapsulation also lets the user store a newly created block in a library and use it as many times as needed in the program, just like any other function block. Example 10-2 illustrates how ladder diagrams can be used to create a custom function block.

E X AM PLE 1 0 -2

Illustrate how the hardwired start/stop circuit shown in Figure 10-6 can be implemented using ladder diagrams in a custom-built function block to turn ON motor M1 and pilot light PL1.

Figure 10-6. Start/stop circuit.

S OLU T I ON

Figure 10-7 illustrates the ladder diagram equivalent of the hardwired start/stop circuit. Note that there are two rungs for the two outputs and that both the input and output variables are specified with the same names that they had in the hardwired circuit.

To implement this simple ladder diagram as a function block, it must be programmed or stored in an encapsulated block (see Figure 10– 8a). The final function block will look like the diagram shown in Figure

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

10-8b. Note that the inputs to the start/stop block will act according to the logic used to program the block. If the driving logic to the start input is ON, then the motor and light will turn ON. If the stop input is ON, then both the motor and light outputs will be OFF. The two input variables (the START and STOP commands), as well as the two output variables (the MOTOR and PILOT_LIGHT signals), are Boolean variables.

PLC Program

Figure 10-7. Ladder diagram equivalent of the circuit in Figure 10-6.

Pilot_Light

STOP

PILOT_LIGHT

Start/Stop Block

PILOT_LIGHT

Figure 10-8. (a) Encapsulated ladder diagram and (b) start/stop block function.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

The flexibility of custom block creation is enhanced by the fact that the user can build custom blocks using ladder diagrams or any of the other IEC 1131-3 languages (IL and ST). Also, custom blocks can be used in conjunc- tion with other standard or vendor-specified function blocks. This allows the programmer to create very powerful function blocks that can be integrated into any ladder diagram or function block diagram. Figure 10-9 shows a custom block instruction that was created in a B&R Industrial Automation PLC using their instruction list language.

Figure 10-9. Custom function block from B & R Industrial Automation.