Cookies are important for this site to function properly, to guarantee your safety, and to provide you with the best experience. By clicking OK, you accept all cookies. For more information, please access our Privacy Policy.
Table of Contents
Tutorials / 
S7-300/400 PLC programming using Siemens’ SIMATIC Manager (Step 7)
Beginner

S7-300/400 PLC programming using Siemens’ SIMATIC Manager (Step 7)

Siemens
STEP 7
S7-300
S7-400

Introduction

This tutorial builds on the SIMATIC Manager Introduction tutorial. If you're just starting with SIMATIC Manager, we recommend reviewing the introductory tutorial for essential background information on project setup, hardware configuration, and block types.

In SIMATIC Manager, programming is a critical aspect of controlling industrial processes. It involves designing logical sequences that govern the behavior of hardware components. We will create a small motor control application using the LADDER language within a Function Block (FB1), which will be called in the main cyclic Organization Block (OB1). 

In this tutorial, you will learn how to create a project, configure hardware components, and program a motor control application using the LADDER language in SIMATIC Manager. We will start by setting up the project and configuring a S7 300 station. Next, we will dive into the details of LADDER programming within a Function Block (FB1), covering the creation of logical sequences and variable assignments. You will also discover how to call the Function Block within the main cyclic program (OB1). To enhance program clarity, we will explore using a Symbol table, allowing you to associate symbolic names with physical input and output addresses. 

Prerequisites

To follow this tutorial, you will need an installation of SIMATIC Manager (Step 7). Here, we will be using the version 5.6. No additional hardware or software is required.

Also, knowledge of the LADDER language would be preferable.

Project Setup

Let’s start by creating a project and configuring a S7 300 station, as shown in the following figure.

Figure 1.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Project Setup
Figure 1.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Project Setup

We are using 315-2 PN/DP CPU and a 16*DI/DO module on the hardware configuration side.

Figure 1.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Hardware Configuration
Figure 1.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Hardware Configuration

Note: You can find more information about the project creation, hardware configuration, and block types in the SIMATIC Manager introduction tutorial.

We will program a small motor control application using the LADDER language for this tutorial. The program will be done in a Function Block (FB1), which will be called the main cyclic Organization Block (OB1). 

Let’s create a new Function Block (FB1). To do this, right-click in the workspace, go to “Insert new Object,” and select “Function Block.”

Figure 1.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Function Block
Figure 1.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Function Block

In the properties window of the FB, select “LAD” in the language list and click “OK.”

Figure 1.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Function Block Properties
Figure 1.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Function Block Properties

Once done, the Function Block (FB1) is created. We can now proceed to its programming.

LADDER programming

Building the program

We will now program the motor control application inside FB1. First, Open FB1. A new window will open containing the programming interface.

Figure 2.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Programming Interface Breakdown
Figure 2.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Programming Interface Breakdown

The programming interface is split as follows:

  1. Block interface: Here, you can define the block’s input, output, and temporary variable. Inputs and outputs are arguments used in the block call.
  2. Workspace: Here, you can assemble instructions to form your program. You can split the program into different networks for better readability.
  3. Instructions list: Here, you can find a list of all the instructions, functions, function blocks, and libraries that can be used in your program.

Let’s start building the program. First, open the “Bit logic” folder in the instruction list and drag a NO contact to your first network.

Figure 2.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Normally Open Contact
Figure 2.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Normally Open Contact

Once done, a NO contact instruction will appear in the network. It is used to interrogate the state of a boolean variable. The red question marks “??.?” indicate that no variable is associated with this instruction. 

Figure 2.3 - Siemens SIMATIC Manager STEP7 PLC Programming | The Normally Open Contact is Added
Figure 2.3 - Siemens SIMATIC Manager STEP7 PLC Programming | The Normally Open Contact is Added

After that, we must create a parallel branch (OR branch). To do this, select the space before the NO contact and click the “Insert branch” button.

Figure 2.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a New Branch
Figure 2.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a New Branch

Once done, a new branch will be created below the first one.

Figure 2.5 - Siemens SIMATIC Manager STEP7 PLC Programming | The New Branch is Added
Figure 2.5 - Siemens SIMATIC Manager STEP7 PLC Programming | The New Branch is Added

Now, add another NO contact in the newly created branch.

Figure 2.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Second Normally Open Contact
Figure 2.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Second Normally Open Contact

Then, we need to close the branch. Select the branch end and click the “Close branch” button to do this.

Figure 2.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Closing The Branch
Figure 2.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Closing The Branch

Once done, the second branch will be closed to join the first one. 

Figure 2.8 - Siemens SIMATIC Manager STEP7 PLC Programming | The Branch is Closed
Figure 2.8 - Siemens SIMATIC Manager STEP7 PLC Programming | The Branch is Closed

We have formed an OR logic operation between the first two NO contacts; we can move to the next section of the program. We now need to add an NC contact in the main branch. Select the central unit and drag an NC contact to it to do this.

Figure 2.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Normally Closed Contact
Figure 2.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Normally Closed Contact

The NC contact is an inverted NO contact. It is used to interrogate a boolean variable but enables itself on the 0 state instead of the 1.

Then, for the last instruction, we need to add an assignment. Drag an assignment instruction to the end of the main branch.

Figure 2.10 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding an Assignment Instruction
Figure 2.10 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding an Assignment Instruction

Assignment instructions copy the logic result of all the previous instructions into another variable. It is symbolized by two brackets ().

Figure 2.11 - Siemens SIMATIC Manager STEP7 PLC Programming | The Assignment Instruction is Added
Figure 2.11 - Siemens SIMATIC Manager STEP7 PLC Programming | The Assignment Instruction is Added

Block interface

Now that we have built the program, we need to add some variables to use it. For this, we will use the block interface. We will configure inputs and outputs to make the block reusable and later call it using them.

First, open the input section (IN). Here, you can define the input variables of the block. 

Figure 3.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Interface Inputs
Figure 3.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Interface Inputs

In the name section, type “Start” and press enter to define the variable that will enable the motor.

Figure 3.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a New Input
Figure 3.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a New Input

By default, the variable is created as a boolean, and that’s what we need, so keep it like that.

Next, do the same to create a “Stop” input that will be used to turn off the motor.

Figure 3.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a Second Input
Figure 3.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a Second Input

Now, head to the output section, where we will create an output variable to command the motor.

Figure 3.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Interface Outputs
Figure 3.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Interface Outputs

In the name section, type “Motor” and press enter. This will create a boolean output.

Figure 3.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating an Output
Figure 3.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating an Output

We have defined all the variables we need. Now, we have to add them to the program. To do this, click on the variable section of the first instruction. Here, you can either type the desired variable's name directly or choose it in a list of all the available variables. Select the “Start” variable.

Figure 3.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Variable to the Program
Figure 3.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Variable to the Program

Once done, the variable will appear above its associated instruction.

Figure 3.7 - Siemens SIMATIC Manager STEP7 PLC Programming | The Variable is Added
Figure 3.7 - Siemens SIMATIC Manager STEP7 PLC Programming | The Variable is Added

Repeat this same operation to add variables to all instructions, as shown in the following figure.

Figure 3.8 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Remaining Variables
Figure 3.8 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Remaining Variables

Function Block call

We are done with the programming of FB1.  Next, we need to call FB1 in the main cyclic program (OB1). Go back to the main interface of SIMATIC Manager and open OB1.

Figure 4.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Opening the OB1
Figure 4.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Opening the OB1

In OB1’s properties, select the LADDER language and click “OK.”

Figure 4.2 - Siemens SIMATIC Manager STEP7 PLC Programming | OB1 Properties
Figure 4.2 - Siemens SIMATIC Manager STEP7 PLC Programming | OB1 Properties

We arrive at a window identical to that of FB1, where we previously had the same interface. We will call FB1 in the first network of OB1.

Figure 4.3 - Siemens SIMATIC Manager STEP7 PLC Programming | OB1 Programming Interface
Figure 4.3 - Siemens SIMATIC Manager STEP7 PLC Programming | OB1 Programming Interface

Open the “FB blocks” folder in the instructions list. Here, you will find all the FBs created in your project. Select FB1 and drag it to network 1.

Figure 4.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Calling Function Block 1 (FB1)
Figure 4.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Calling Function Block 1 (FB1)

Once done, a Function Block call will appear in the network. The first thing to notice is the arguments of the block,, which are the interface inputs and output we defined earlier. Furthermore, the block is missing its instance DB, indicated by the three red question marks above it. All FBs must be associated with a DB when they're called. 

Figure 4.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Function Block 1 (FB1) Call is Added to Ladder Logic
Figure 4.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Function Block 1 (FB1) Call is Added to Ladder Logic

Let’s create the instance DB. To do this, go back to SIMATIC Manager’s main interface and right-click anywhere in the workspace. After that, go to “Insert Nw Object” and select “Data Block.”

Figure 4.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Data Block (DB)
Figure 4.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding a Data Block (DB)

Then, in the DB’s properties, the default DB type is set to “Shared DB” which means that this is a global DB. We need to change the type to make it an instance DB.

Figure 4.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Data Block (DB) Properties
Figure 4.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Data Block (DB) Properties

Open the types list and select “Instance DB.” 

Figure 4.8 - Siemens SIMATIC Manager STEP7 PLC Programming | Changing the Data Block (DB) Type
Figure 4.8 - Siemens SIMATIC Manager STEP7 PLC Programming | Changing the Data Block (DB) Type

Once done, the next field becomes available where you can indicate its associated FB. Since FB1 is the only FB present in the project, it is selected by default. Finish by clicking on “OK.”

Figure 4.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Selecting the Associated Function Block (FB)
Figure 4.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Selecting the Associated Function Block (FB)

Now, go back to the OB1. We need to add the DB1 to the FB1 call. To do so, you can apply the same logic as we did to add variables to the FB1 instructions. Select “DB1” in the suggestions list.

Figure 4.10 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Data Block to the Block Call
Figure 4.10 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Data Block to the Block Call

Once done, DB1 is added to FB1’s call. 

Figure 4.11 - Siemens SIMATIC Manager STEP7 PLC Programming | The Data Block is Added
Figure 4.11 - Siemens SIMATIC Manager STEP7 PLC Programming | The Data Block is Added

Symbol Table

The last step of this tutorial is to add physical inputs and outputs to the function call. It is possible to enter the desired input/output address simply, but more is needed for the program's readability. Therefore, we will use a Symbol table, which allows us to associate symbolic names with memory addresses.

To do so, in OB1’s programming interface, open the “Options” menu and click on “Symbol Table.”

Figure 5.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Opening the Symbol Table
Figure 5.1 - Siemens SIMATIC Manager STEP7 PLC Programming | Opening the Symbol Table

The symbol table will open in a new window. Here, you can define symbolic names for the input, output, and memory addresses used in your program, offering better readability. 

Figure 5.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Symbol Table Interface
Figure 5.2 - Siemens SIMATIC Manager STEP7 PLC Programming | Symbol Table Interface

In our motor control application, we need two physical inputs (one for the start button and the other for the stop button). and one physical output (that commands the motor). Let’s start by defining the start button symbol. To do this, simply type “Start_button” in the Symbol section and press enter.

Figure 5.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a New Symbol
Figure 5.3 - Siemens SIMATIC Manager STEP7 PLC Programming | Creating a New Symbol

After that, we need to specify the address of the physical input. We will use the first input available in the module so it is “I 0.0”

Figure 5.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Setting the Symbol's Address
Figure 5.4 - Siemens SIMATIC Manager STEP7 PLC Programming | Setting the Symbol's Address

Repeat this same operation to add a “Stop_button” symbol in the I 0.1 address.

Figure 5.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Second Symbol
Figure 5.5 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Second Symbol

Then, for the motor output, repeat once again the same operation but use the Q 0.0 address to indicate that it's a physical output.

Figure 5.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Third Symbol
Figure 5.6 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Third Symbol

We are done defining the symbols, we can add them to the block call. In the same way as when we added variables to the FB1 program, add the “Start_button” symbol to the “Start” input of the block call.

Figure 5.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Symbol to the Start Input
Figure 5.7 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Symbol to the Start Input

This will add the symbol with its address to the “Start” input field.

Figure 5.8 - Siemens SIMATIC Manager STEP7 PLC Programming | The Symbol is Added
Figure 5.8 - Siemens SIMATIC Manager STEP7 PLC Programming | The Symbol is Added

Then repeat this operation to add the corresponding symbols to the I/Os as shown in the following figure.

Figure 5.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Remaining Symbols
Figure 5.9 - Siemens SIMATIC Manager STEP7 PLC Programming | Adding the Remaining Symbols

Conclusion

In this tutorial, you learned how to navigate Siemens' SIMATIC Manager to set up a project and program a motor control application using the LADDER language. We started by creating a project, configuring an S7-300 station, and designing a Function Block (FB1) to execute our motor control logic. After that, we built a program within the FB1, established logical connections, and defined variables for enhanced control. We also explored the integration of this Function Block into the main cyclic program (OB1) and improved program readability using a Symbol table.

As you move forward in your journey of PLC programming, the next crucial step is to test your program's functionality using simulation. Simulation allows you to verify the logic and functionality of your program without affecting real-world processes and equipment. This will be the subject of the SIMATIC Manager PLCSim tutorial.