How to Write Your First PLC Program in Siemens TIA Portal

A Programmable Logic Controller (PLC) is a specialized digital industrial computer. It has been designed and ruggedized to reliably handle automation and control tasks in industrial environments where dust, vibration, heat, and electrical noise are present.

It constantly monitors the state of connected input devices, makes logical decisions using a custom user-defined program, then updates the state of output devices.  

This article introduces the fundamental steps for programming a PLC using Totally Integrated Automation Portal (TIA Portal) software from Siemens. It explains the importance of TIA Portal as a development tool. 

Then, it describes how to configure the software, and shows step-by-step instructions to create a program using ladder logic (LD).

Finally, it walks through the process of downloading the program into a real PLC and verifying its operation.

The Siemens TIA Portal

The TIA Portal is Siemens’ flagship engineering framework. It is an all-in-one software suite that provides a single, unified platform for programming, configuring, and commissioning automation systems.

Instead of using multiple separate tools, TIA Portal integrates all essential automation engineering functions into one environment, making it easier for engineers to work efficiently.

Within TIA Portal, different engineering tools coexist in harmony. For PLCs, it uses STEP 7, which is the programming environment. For operator interfaces such as Human-Machine Interfaces (HMIs), it uses WinCC

For drive systems and motion control, it integrates Startdrive. This tight integration means that an engineer can configure hardware, program logic, and design operator panels in a consistent workflow.

Why choose TIA Portal?

TIA Portal is widely chosen because it significantly streamlines the entire engineering process.

It allows engineers to reduce development time, eliminate redundancies, and increase consistency across projects. 

The intuitive user interface, powerful libraries, and drag-and-drop features help make programming accessible, even to beginners.

Another advantage is its flexibility in supporting multiple international programming languages defined by IEC 61131-3. These include:

  • Ladder Logic (LAD) – graphical, easy to understand, resembles electrical circuits.
  • Function Block Diagram (FBD) – suited for process control and data flow.
  • Structured Control Language (SCL) – text-based, similar to high-level programming languages.

This versatility makes TIA Portal a preferred choice for both newcomers and experienced engineers working on complex industrial automation projects.

The Best PLC Simulation Software in 2025

Scheme of TIA Portal + PLC + HMI

How to Write Your First PLC Program in Siemens TIA Portal

Step 1: Planning your first program

Define your application

Before any code is written, the very first step in PLC programming is planning. A well-structured plan ensures that the logic is clear, the requirements are met, and unnecessary mistakes are avoided.

Clearly define what you want the program to achieve. For beginners, it is best to start with a simple application that illustrates basic control principles.

Example application: A motor start/stop circuit using pushbuttons and an indicator lamp.

Requirements:

  • A start pushbutton should turn the motor ON.
  • A stop pushbutton should turn the motor OFF.
  • The motor should remain running (latched) even after the start pushbutton is released.
  • A status light should indicate when the motor is running.

This simple yet practical example teaches the concept of latching circuits, which is fundamental in PLC programming.

Define your inputs and outputs (I/O)

Every PLC program is connected to real-world devices. These devices are classified as inputs (information coming into the PLC) and outputs (commands sent from the PLC).

To avoid confusion, each device must be clearly listed, assigned a descriptive tag name, and mapped to a data type.

DeviceTypeData TypeDescription
Start_PBInputBOOLActivated when the start pushbutton is pressed
Stop_PBInputBOOLActivated when the stop pushbutton is pressed
Motor_RunningOutputBOOLControls the motor starter coil
Motor_Light_ONOutputBOOLTurns on the lamp when the motor is running

Step 2: Creating a new project

Launch TIA Portal

Open TIA Portal software from your desktop or start menu. Once the program loads, you will see the start screen with several options.

Create a new project

  1. On the start screen, click “Create new project”.
  2. Enter a project name, such as My_First_PLC_Program.
  3. Choose a file path to save the project.
  4. Click “Create” to confirm.

Configure a device

  1. On the “First steps” page, click “Configure a device”.
  2. Select “Add new device”.
  3. Expand the Controllers folder.
  4. Choose from the SIMATIC S7-1200 or S7-1500 series. (The S7-1200 is highly recommended for beginners due to its affordability and flexibility.)
  5. Select the exact CPU model that matches your hardware.
  6. Click “Add” to include it in the project.
Creating new project and configure a device

Step 3: Hardware configuration

Assigning IP address

  1. Once the CPU is added, the device view opens.
  2. In the properties window at the bottom, select “PROFINET interface”.
  3. Under Ethernet addresses, enter an IP address for the PLC, e.g., 192.168.0.1.
  4. This address will be used later to connect the PC with the PLC.

Configuring I/O addresses

  1. In the same properties, go to “I/O addresses”.
  2. These addresses are where the PLC program links to actual hardware inputs and outputs.
  3. By default, for an S7-1200, inputs often start at %I0.0 and outputs at %Q0.0.
  4. Verify or adjust these addresses to match your application.

Step 4: Creating PLC tags

Open the default tag table

  1. In the project tree, expand “PLC tags”.
  2. Double-click “Default tag table”.
  3. A table opens where you can create tags for your I/O devices.

Add your tags

  1. Add a new tag for each I/O defined in the plan.
  2. Assign tag names and data types (all BOOL in this example).
  3. The software automatically assigns addresses, but they can be changed.
Tag NameData TypeAddress
Start_PBBOOL%I0.0
Stop_PBBOOL%I0.1
Motor_RunningBOOL%Q0.0
Motor_Light_ONBOOL%Q0.1
Tag table

Step 5: Writing the Ladder Logic program

Open the Main Program Block (OB1)

  1. Expand “Program blocks” in the project tree.
  2. Double-click “Main [OB1]”.
  3. This block runs cyclically and forms the backbone of the program.

Program Network 1: Start/Stop logic

This network contains the motor latching circuit.

  1. From the Basic Instructions panel, drag a Normally Open Contact (NO).
  2. Place another NO contact in parallel with it.
  3. Add a Normally Closed Contact (NC) in series.
  4. Place a Coil (=) at the end.

Wiring:

  • Assign Start_PB to the first NO contact.
  • Assign Motor_Running to the parallel NO contact.
  • Assign Stop_PB to the NC contact.
  • Assign Motor_Running to the coil.

Logic: If Start_PB is pressed OR Motor_Running is already latched, AND Stop_PB is not pressed, then Motor_Running stays ON.

Latching logic

Program Network 2: Status light

This network turns on the lamp when the motor is running.

  1. Insert an NO contact.
  2. Insert a Coil.
  3. Assign Motor_Running to the contact.
  4. Assign Motor_Light_ON to the coil.

Logic: If Motor_Running = TRUE, then Motor_Light_ON = TRUE.

Motor status light

Step 6: Simulating the program

Start the simulation

  1. Save the project.
  2. Select the PLC in the project tree.
  3. Click “Start simulation”.
  4. Confirm the pop-up window.
  5. The program compiles and loads into the virtual PLC.
  6. Select “Start all” to begin simulation.

Test with a watch table

  1. Expand “PLC tags”“Show all tags”.
  2. Open the watch table.
  3. Modify the Start_PB tag to True. Observe Motor_Running and Motor_Light_ON.
  4. Return Start_PB to False – the motor should remain latched.
  5. Change Stop_PB to True – the motor and lamp should turn off.
Watch table

Step 7: Downloading to a physical PLC

Establish communication

  1. Connect PC to PLC via Ethernet.
  2. In TIA Portal, click “Go online”.
  3. Select your network adapter.
  4. Search for accessible devices.
  5. Assign an IP if required.

Download the program

  1. Right-click CPU → “Download to device”.
  2. Select hardware + software.
  3. Confirm settings → Load.
  4. After download, choose “Start all modules”.
  5. The PLC enters RUN mode.

Monitor and debug

  1. Open OB1.
  2. Enable Monitoring on/off.
  3. Observe green power flow lines.
  4. Use pushbuttons to test and verify outputs.
PLC and motor

Key Takeaways: How to Write Your First PLC Program in Siemens TIA Portal

You have successfully gone through the process of planning, programming, simulating, and downloading a PLC program using Siemens TIA Portal.

This motor start/stop application demonstrates a core concept: latching circuits, which are the foundation of industrial automation.

By mastering this workflow, you now have a solid base to explore more advanced topics such as timers, counters, data blocks, and structured programming. Always remember to:

  • Plan your project carefully before coding.
  • Use descriptive tag names for clarity.
  • Simulate and test your program thoroughly before deploying.

With experience, you will be able to create structured, scalable PLC applications that control entire production systems.

FAQ: How to Write Your First PLC Program in Siemens TIA Portal

What is TIA Portal used for?

TIA Portal is Siemens’ engineering software used to program PLCs, configure HMIs, commission drives, and manage industrial networks within one integrated environment.

Which PLCs can be programmed with TIA Portal?

TIA Portal mainly supports Siemens PLCs such as the S7-1200, S7-1500, S7-300, and S7-400, along with related devices.

Is ladder logic the only programming language available?

No. TIA Portal supports LAD, FBD, SCL, and also function charts, giving engineers flexibility in programming style.

Do I need real hardware to practice?

Not necessarily. TIA Portal includes PLCSIM, a simulation tool that allows you to test logic without a physical PLC.

How do I connect my PLC to TIA Portal?

You typically connect via Ethernet, assign an IP address, and then use the “Go online” function to establish communication.

Can I program safety PLCs with TIA Portal?

Yes, Siemens offers Fail-Safe CPUs that can be programmed in TIA Portal with additional safety libraries.

    Leave a Comment