Siemens PLC · TIA Portal · STEP 7 · SCL

Siemens PLC Data Types – Complete STEP 7 & TIA Portal Guide

Understand the major Siemens PLC data types used in STEP 7 and TIA Portal—from BOOL, INT, DINT and REAL to time values, strings, arrays, structures, UDTs, references and VARIANT—with practical SCL examples and CPU-family guidance.

S7-1200 / S7-1500 SCL Examples UDT / STRUCT / ARRAY CPU Support Guide

Learning Overview

Topic: Siemens PLC data typesSoftware: STEP 7 / TIA PortalPlatforms: S7-300/400, S7-1200, S7-1500, S7-1200 G2Examples: SCL / Structured Text

What You’ll Learn

  • How Siemens data types control memory, value range and permitted operations
  • Binary, integer, floating-point, time, date and string data types
  • How to use ARRAY, STRUCT and PLC data types / UDTs for scalable programming
  • Where references, VARIANT and hardware-related types fit into advanced projects
  • How CPU family influences which data types are available
Core idea

Every PLC variable needs a defined representation. The selected data type determines how much memory is reserved, which values are valid, which operations can be applied, and how clearly the variable communicates engineering intent to the next programmer.

  • Choose the smallest practical type that still covers the engineering range.
  • Use signed or unsigned types deliberately instead of treating every value as a generic integer.
  • Group repeated machine objects with STRUCTs and PLC data types / UDTs.
  • Confirm support on the target CPU before using newer long, Unicode, reference or generic types.

Siemens PLC Data Types in TIA Portal

This guide is designed for searches around Siemens PLC data types, TIA Portal data types, S7-1200 data types, S7-1500 data types, BOOL INT DINT REAL, Siemens UDT and SCL data type examples.

1. Why Siemens PLC Data Types Matter

Data types are easy to overlook because they sit behind every tag, parameter and data-block member. But the type you choose affects memory usage, usable range, arithmetic behavior, interfaces and code readability. A poor choice can lead to overflow, unnecessary memory allocation or code that is difficult to maintain.

Engineering impact

Data type selection influences memory footprint, numerical range, precision and how efficiently values are processed.

Maintenance impact

A well-chosen type makes intent obvious—for example, a BOOL for a status, DINT for a large total, or a UDT for a complete motor object.

2. Siemens PLC Data Type Families

Elementary TypesBasic building blocks such as BOOL, INT, DINT, REAL, TIME, CHAR and STRING.
Complex TypesStructures that organize multiple elements, especially ARRAY and STRUCT.
PLC Data Types / UDTsReusable named structures for devices, machines, recipes and repeated engineering objects.
Pointer / Reference TypesIndirect addressing and generic-programming mechanisms such as ANY, REFERENCE TO and VARIANT.
System TypesPredefined structures used by standardized timers, counters, errors and communication blocks.
Hardware TypesTyped references to physical devices, I/O, high-speed counters, PWM channels and related hardware resources.
Platform matters: not every data type is available on every Siemens CPU. Legacy S7-300/400 systems use a smaller type set, while S7-1200, S7-1500 and newer S7-1200 G2 platforms add more long, unsigned, Unicode, reference and generic types.

3. Binary Types: BOOL, BYTE, WORD, DWORD and LWORD

At the lowest level, PLCs process individual bits and groups of bits. BOOL represents one logical state: TRUE or FALSE. It is ideal for switches, permissives, interlocks, alarm states and running feedback.

SCL example – BOOL logic

VAR
  pump_enabled : BOOL := FALSE;
  pump_fault : BOOL := FALSE;
END_VAR

pump_enabled := start_button AND NOT pump_fault;

For grouped binary data, Siemens provides BYTE (8 bits), WORD (16 bits) and DWORD (32 bits). On newer platforms, LWORD extends the same concept to 64 bits. These types are useful for status words, masks, raw device data and bitwise operations.

BOOL · 1 bitBYTE · 8 bitWORD · 16 bitDWORD · 32 bitLWORD · 64 bit
VAR
  device_status : DWORD := 0;
END_VAR

device_status.0 := 1;    // Device ready
device_status.2 := 1;    // Communication OK

4. Whole Numbers: Signed and Unsigned Integers

Integer types are the workhorses of counting, indexing and discrete calculations. Signed types allow negative and positive values, while unsigned types use the same bit width entirely for zero and positive values.

TypeWidthSigned?Typical use
SINT8 bitYesSmall signed values
USINT8 bitNoSmall positive values, percentage-like raw values
INT16 bitYesCounters, indexes, engineering values
UINT16 bitNoPositive counts and positions
DINT32 bitYesLarge counters and totals
UDINT32 bitNoLarge positive counters and IDs
LINT64 bitYesVery large signed values
ULINT64 bitNoVery large non-negative values

SCL example – production totals

VAR
  total_parts_produced : DINT := 0;
  parts_this_cycle : INT := 50;
  daily_target : DINT := 10000;
END_VAR

total_parts_produced := total_parts_produced + parts_this_cycle;

Unsigned types are particularly useful when a value can never be negative. They can represent a larger positive range than a signed type of the same width and also communicate that engineering intent to anyone reading the program.

VAR
  led_brightness : USINT := 75;
  pwm_value : USINT;
END_VAR

pwm_value := (led_brightness * 255) / 100;

5. Decimal Values: REAL and LREAL

REAL is a 32-bit floating-point type commonly used for analog values, process variables, scaling and engineering calculations. LREAL is a 64-bit floating-point type used where higher precision or a wider numeric range is required and supported by the CPU.

VAR
  voltage : REAL := 10.5;
  current : REAL := 2.3;
  power : REAL;
END_VAR

power := voltage * current;
Performance note: floating-point math generally costs more processing time than integer math. In very time-critical logic, consider whether a scaled integer can satisfy the accuracy requirement.

6. Timer and Duration Types: S5TIME, TIME and LTIME

S5TIME is a legacy Siemens time format retained for compatibility with older projects. TIME is the standard IEC duration type and is widely used for delays, elapsed times and timer parameters. LTIME extends duration handling on supported modern CPUs with much larger range and finer resolution.

VAR
  input_signal : BOOL;
  timer_value : TIME := T#0s;
  max_delay : TIME := T#5s;
  output_signal : BOOL := FALSE;
END_VAR

IF timer_value < max_delay THEN
  timer_value := timer_value + T#10ms;
ELSE
  output_signal := TRUE;
END_IF;

7. Calendar and Clock Types

Automation systems often need both durations and actual timestamps. DATE stores a calendar date, while TIME_OF_DAY (TOD) stores a time of day. Legacy DT (DATE_AND_TIME) combines date and clock information for timestamping and logging.

Newer platforms add types such as DTL, which exposes individual timestamp fields including year, month, day, weekday, hour, minute and second. Higher-resolution long variants include LDT and LTOD on supported CPUs.

VAR
  current_dtl : DTL;
END_VAR

IF (current_dtl.weekday = 5) AND (current_dtl.hour = 22) THEN
  is_maintenance_day := TRUE;
END_IF;

8. Text Types: CHAR, STRING, WCHAR and WSTRING

CHAR stores a single one-byte character, while STRING stores a sequence of single-byte characters. On S7-1200/1500-class systems, standard STRING is commonly declared with a maximum of up to 254 characters. For Unicode text, newer platforms provide WCHAR and WSTRING.

Siemens documentation note: standard STRING and Unicode WSTRING have CPU/version-specific storage and declared-length rules. Define only the string length your application actually needs to avoid unnecessary memory use.
VAR
  device_type : STRING := 'Pump';
  device_number : INT := 3;
  device_id : STRING;
END_VAR

device_id := CONCAT(device_type, '_', INT_TO_STRING(device_number));
// Result: 'Pump_3' 

9. ARRAY, STRUCT and PLC Data Types / UDTs

Complex data types are essential for scalable automation software. A reusable PLC data type / UDT groups related fields into one named engineering object. For example, speed, direction, current, status and enable information for a motor can be defined once and reused consistently across data blocks and block interfaces.

TYPE Motor_Control
  STRUCT
    speed : INT;
    direction : BOOL;
    current_draw : REAL;
    status : STRING;
    enabled : BOOL;
  END_STRUCT
END_TYPE

VAR
  main_motor : Motor_Control;
END_VAR

main_motor.speed := 1800;
main_motor.enabled := TRUE;

An anonymous STRUCT is useful when the grouped layout is required only locally. An ARRAY creates an indexed collection of elements of the same type and is ideal for sensor banks, recipes, production values and repeated machine data.

VAR
  sensor_array : ARRAY[1..16] OF REAL;
  max_reading : REAL := 0.0;
END_VAR

FOR sensor_index := 1 TO 16 DO
  IF sensor_array[sensor_index] > max_reading THEN
    max_reading := sensor_array[sensor_index];
  END_IF;
END_FOR;
When to create a UDT

If a machine object has several related values that repeat across the project, a named PLC data type usually gives cleaner interfaces, consistent structures and easier future changes than many unrelated standalone tags.

10. POINTER, ANY, REFERENCE TO and VARIANT

Advanced Siemens programming includes several forms of indirect or generic data access. Classic POINTER and ANY types are strongly associated with legacy S7 programming and compatibility scenarios. Modern projects increasingly use more type-aware mechanisms where supported.

REFERENCE TO provides typed references on supported newer CPUs, while VARIANT is used in generic block interfaces when the concrete data type can vary at runtime and the called instruction is designed to handle that behavior.

VAR
  temperature : REAL := 25.0;
  temp_ref : REFERENCE TO REAL;
END_VAR

temp_ref := ADR(temperature);
temp_ref^ := 30.0;
FUNCTION Log_Value
  VAR_INPUT
    value : VARIANT;
    label : STRING;
  END_VAR
BEGIN
  // Generic processing depends on the supported VARIANT instructions.
END_FUNCTION
Advanced-use caution: pointer/reference and VARIANT behavior depends heavily on CPU family, block interface rules and the exact TIA Portal instruction set. Use them deliberately and test the target configuration rather than treating them as universal replacements for strongly typed interfaces.

11. System and Hardware Types

STEP 7 also provides predefined types for system functions and physical hardware. Examples include standardized timer/counter structures, error-information structures and communication parameter types. Hardware-related types represent configured devices and I/O resources so program blocks can work with engineering objects rather than only raw numeric addresses.

IEC_TIMERIEC_COUNTERERROR_STRUCTTCON_ParamHW_DEVICEHW_IOHW_HSCHW_PWM

12. Which Siemens CPU Supports Which Data Types?

The following quick-reference table follows the supplied STEP 7 data-type overview. Always check the exact CPU firmware and TIA Portal version before treating the table as a compile-time guarantee.

Data type / categoryS7-300/400S7-1200S7-1500S7-1200 G2
BOOL, BYTE, WORD, DWORD
LWORD
INT, DINT
SINT, USINT, UINT, UDINT
LINT, ULINT
REAL
LREAL
DATE, TOD
DTL
LDT, LTOD
STRING
WSTRING, WCHAR
ARRAY, STRUCT, UDT
References
VARIANT
Best practice: when creating reusable libraries, define the lowest target CPU family first. A type that compiles on S7-1500 or S7-1200 G2 may not be available in a legacy S7-300/400 migration project.

13. Siemens PLC Data Type Best Practices

  • Right-size the type. Do not allocate a large numeric type when a smaller range is guaranteed and the smaller type improves clarity.
  • Use signed and unsigned values intentionally. Select unsigned types when negative values are impossible and the CPU/platform supports them.
  • Build reusable UDTs for complex equipment. Repeated device structures are easier to maintain when their members are centrally defined.
  • Check the target CPU. Long, Unicode, reference and generic types are not universal across all S7 generations.
  • Keep time-critical logic efficient. Avoid unnecessary floating-point and heavy string manipulation inside tight cyclic loops.
  • Declare realistic string lengths. Reserving only the required text length improves memory discipline and documents the intended interface.

Practical Selection Guide

RequirementTypical Siemens type
On/off status, alarm, permissiveBOOL
Raw status bits or bit maskBYTE, WORD, DWORD
Small signed count or indexINT or SINT where supported
Large production totalDINT or UDINT
Analog/process engineering valueREAL
Elapsed durationTIME
Calendar/time logicDATE, TOD, DTL
Short equipment label/messageSTRING[n]
Unicode textWSTRING[n] where supported
Repeated device objectPLC data type / UDT
Repeated same-type valuesARRAY
Generic advanced interfaceVARIANT or reference mechanisms where supported

Frequently Asked Questions

What are the main Siemens PLC data type families?

Siemens PLC data types can be grouped into elementary types, complex types such as ARRAY and STRUCT, user-defined PLC data types or UDTs, pointer/reference types, and system or hardware-related types.

What is the difference between INT and DINT in Siemens PLCs?

INT is a 16-bit signed integer, while DINT is a 32-bit signed integer. DINT is suitable when counters, totals, positions or calculations can exceed the INT range.

When should I use REAL or LREAL?

Use REAL for common process values and analog calculations. Use LREAL where the CPU supports it and higher numerical precision or a wider floating-point range is required.

What is a UDT in TIA Portal?

A UDT, commonly implemented as a PLC data type, groups related fields into a reusable named structure. It is useful for motors, valves, machines, recipes and other repeated engineering objects.

Do all Siemens S7 CPUs support the same data types?

No. Legacy S7-300/400 controllers support a smaller set, while S7-1200, S7-1500 and newer S7-1200 G2 platforms support additional integer, long, Unicode, reference and generic data types depending on the CPU and engineering version.

Reference

The supplied source cites STEP 7 V21 – Overview of the Valid Data Types, Siemens TIA Portal Documentation. For production work, always confirm data-type availability and limits in the documentation for the exact CPU firmware and TIA Portal version used in the project.

Get Siemens PLC & SCL Training Details

Share your details and a Softwell advisor will contact you with practical Siemens PLC, TIA Portal, SCL and project-development training options.

Build stronger Siemens PLC programming fundamentals

Learn TIA Portal, Ladder, SCL, HMI/SCADA integration and project-development practices through practical training.

Request Course Details
Verified learning pathway

Discuss Siemens PLC, TIA Portal & SCL Training

Explore practical Siemens S7-1200/S7-1500 PLC programming, SCL, HMI/SCADA and industrial automation training options.

Content reviewed: 7 August 2026

☎ Call WhatsApp ✉ Email Enquire Now