Comparison of Editors: LAD, FBD, STL (GS 2.5)

The SIMATIC S7-200 CPUs offer many types of instructions that allow you to solve a wide variety of automation tasks. There are two basic instruction sets available in the S7-200 CPU: SIMATIC and IEC 1131-3. STEP 7-Micro/WIN 32 provides different editor choices that allow you to create control programs with these instructions. For example, you may prefer to create programs in a graphical environment, while someone else in your company may prefer a text-based assembly-language style of editor.

You have two fundamental choices to consider whenever you create your programs.

·The type of instruction set that is best for your application (SIMATIC or IEC 1131-3 )

·The type of editor that is best for your programming needs (Statement List, Ladder Logic, or Function Block Diagram)

The following instruction set and editor combinations are possible:

·SIMATIC instruction set with LAD, FBD, or STL editor

·IEC 1131-3 instruction set with LAD or FBD editor

This topic describes the three program editors:

Ladder Logic

Function Block Diagram

Statement List

Ladder Logic Editor

Back to Top

The STEP 7-Micro/WIN 32 Ladder Logic (LAD) editor allows you to build programs that resemble an electrical wiring diagram. Ladder programming is the method of choice for many PLC programmers and maintenance personnel; it is an excellent language for beginning programmers. Basically, the ladder programs allow the CPU to emulate the flow of electric current from a power source, through a series of logical input conditions that in turn enable logical output conditions. The logic is usually separated into small, easy-to-understand pieces that are often called “rungs” or “networks.” The program is executed as dictated by the program, one network at a time, from left to right and then top to bottom. Once the CPU has reached the end of the program, it starts over again at the top of the program.

The figure below shows an example of a ladder program.

The various instructions are represented by graphic symbols and include three basic forms.

Contacts – represent logic “input” conditions analogous to switches, buttons, internal conditions and so on.

Coils – usually represent logic “output” results analogous to lamps, motor starters, interposing relays, internal output conditions and so on.

Boxes – represent additional instructions such as timers, counters, or math instructions.

The networks that you can build in ladder logic range from the simple to the very complex. You can create networks with midline outputs; you can even connect multiple box instructions in series. Box instructions that can be connected in series are labeled with an Enable Output (ENO) line. If a box has power flow at the EN input and executes without error, the ENO output passes power flow to the next element. ENO can be used as an enable bit that indicates the successful completion of an instruction. The ENO bit is used with the top of stack to affect power flow for execution of subsequent instructions.

Note:

The ENO feature is only available with STEP 7-Micro/WIN 32 V3.0 (or later) programming software when used with a CPU 221, CPU 222, CPU 224, CPU 226, or CPU 226XM.

The main points to consider when you select the LAD editor are:

·Ladder logic is easy for beginning programmers to use.

·Graphical representation is often easy to understand, and is popular around the world.

·The LAD editor can be used with both the SIMATIC and IEC 1131-3 instruction sets.

·You can always use the STL editor to display a program created with the LAD editor.

Function Block Diagram Editor

Back to Top

The STEP 7-Micro/WIN 32 Function Block Diagram (FBD) editor allows you to view the instructions as logic boxes that resemble common logic gate diagrams. There are no contacts and coils as found in the LAD editor, but there are equivalent instructions that appear as box instructions. The program logic is derived from the connections between these box instructions. That is, the output from one instruction (such as an AND box) can be used to enable another instruction (such as a timer) to create the necessary control logic. This connection concept allows you to easily solve a wide variety of logic problems, just as you can with the other editors.

The figure below shows an example of a program created with the Function Block Diagram editor.

If a box has power flow at the EN input and executes without error, the ENO output passes power flow to the next element. ENO can be used as an enable bit that indicates the successful completion of an instruction. The ENO bit is used with the top of stack to affect power flow for execution of subsequent instructions.

Note:

The ENO feature is only available with STEP 7-Micro/WIN 32 V3.0 (or later) programming software when used with a CPU 221, CPU 222, CPU 224, CPU 226, or CPU 226XM.

The main points to consider when you select the FBD editor are:

·The graphical logic gate style of representation is good for following program flow.

·The FBD editor can be used with both the SIMATIC and IEC 1131-3 instruction sets.

·You can always use the STL editor to display a program created with the LAD editor.

·The expandable AND/OR boxes make it easier to draw complex input combinations.

Statement List Editor

Back to Top

The STEP 7-Micro/WIN 32 Statement List (STL) editor allows you to create control programs by entering the instruction mnemonics. In general, the STL editor is more suitable for experienced programmers who are familiar with PLCs and logic programming. The STL editor also allows you to create programs that you could not otherwise create with the Ladder Logic or Function Block Diagram editors. This is because you are programming in the native language of the CPU, rather than a graphical editor where some restrictions must be applied in order to draw the diagrams correctly. The figure below shows an example of a statement list program.

NETWORK 1
LD I0.0
LD I0.1
LD I2.0
A I2.1
OLD
ALD
=Q5.0

As you can see from the figure, this text-based concept is very similar to assembly language programming. The CPU executes each instruction, in the order dictated by the program, from top to bottom, and then restarts at the top. STL and assembly language are also similar in another sense. S7-200 CPUs use a logic stack to resolve the control logic. The LAD and FBD editors automatically insert the instructions that are necessary to handle the stack operation. In STL, you have to insert these instructions to handle the stack on your own. The figure below shows a simple program in LAD and the corresponding program in STL.

NETWORK 1
LD I0.0
LD I0.1
LD I2.0
A I2.1
OLD
ALD
= Q5.0

The figure below shows what is happening in the stack:

  Instructions
Stack LD I0.0 LD I0.1 LD I2.0 A OLD ALD
S0 I0.0 I0.1 I2.0 I2.0 AND I2.1 (I2.0 AND I2.1) OR I0.1 I0.0 AND [(I2.0 AND I2.1) OR I0.1]
S1   I0.0 I0.1 I0.1 I0.0  
S2     I0.0 I0.0    
S3            
S4            
S5            
S6            
S7            
S8            

The main points to consider when you select the STL editor are:

·STL is most appropriate for experienced programmers.

·STL sometimes allows you to solve problems that you cannot solve easily with the LAD or FBD editor.

·You can only use the SIMATIC instruction set with the STL editor. There is no IEC instruction set for STL.

·While you can always use the STL editor to view or edit a program that was created with the SIMATIC LAD or FBD editors, the reverse is not always true. You cannot always use the SIMATIC LAD or FBD editors to display a program that was written with the STL editor.

See Also:

Comparison of Programming Modes: SIMATIC, IEC (GS 2.6)

ENO