TIA Portal Instructions

Conversion Operations
Scaling & Types

Data conversion is the bridge between the physical world and digital code. Master analog signal scaling and data type transformation.

What are Conversion Operations in TIA Portal?

Conversion operations allow transforming a value from one data type to another (e.g., an Integer to a Real) or manipulating the precision of floating-point numbers. They also include normalization and scaling tools, essential for processing analog signals from industrial sensors.

TIA Portal offers modern and high-performance instructions like SCALE_X and NORM_X that advantageously replace the old SCALE/UNSCALE blocks of S7-300 systems, providing greater flexibility and better mathematical precision.

Type Conversion

Transformation and rounding of numerical formats

CONVERT — Convert value

CONV

What it does

Converts a value from a source data type to a destination data type. Handles conversions between integers, reals, characters, and even time or string formats.

When to use it

Preparing an integer for complex math by converting it to Real, or converting an error code to String for HMI display.

Pro Tips

In LAD, click on the block's data types to select source and target.

In SCL, simply use the destination type name as a function: myReal := INT_TO_REAL(myInt);

Watch out for precision loss when converting large types to shorter ones.

ROUND / TRUNC

ROUND

What they do

ROUND rounds a floating-point number to the nearest integer. TRUNC simply removes the decimal part (truncation).

When to use it

Displaying a physical measurement as a simple integer, or converting a Real calculation result to an array index (Int).

Pro Tips

If the decimal part is exactly .5, ROUND rounds to the nearest even integer (IEC standard).

TRUNC is preferable if you only want to ignore decimals without rounding calculations.

Both accept Real/LReal as input and typically return a DInt.

CEIL / FLOOR

CEIL

What they do

CEIL (Ceiling) generates the next higher or equal integer. FLOOR generates the next lower or equal integer.

When to use it

Calculating the number of bins needed (always round up with CEIL), or determining safety limits.

Pro Tips

CEIL(10.1) = 11; FLOOR(10.9) = 10.

Essential for packing and logistics algorithms.

Very useful for ensuring a value stays within strict integer bounds.

Scaling

Analog signal processing and physical quantities

NORM_X — Normalize

NORM_X

What it does

Transforms a value within a [MIN..MAX] range to a normalized value between 0.0 and 1.0. This is the first step of analog processing.

When to use it

Reading a raw analog input (e.g., 0-27648) and transforming it into a percentage (0.0-1.0).

Pro Tips

Typically followed immediately by a SCALE_X block.

If the input exceeds MIN/MAX bounds, the output will exceed 0.0 or 1.0 (linearity preserved).

Ensure MIN is different from MAX to avoid division by zero.

SCALE_X — Scale

SCALE_X

What it does

Takes a normalized value [0.0..1.0] and projects it onto a physical range defined by MIN and MAX (e.g., 0-100°C or 0-10 bar).

When to use it

Converting the result of a NORM_X into an engineering unit readable by the operator.

Pro Tips

The NORM_X + SCALE_X combination is the standard Siemens method for modern analog scaling.

Allows easily changing sensor range without modifying the entire program.

Can also be used for the inverse: sending a physical setpoint to an analog output.

Legacy Instructions

S7-300 compatibility (FC105 / FC106)

SCALE / UNSCALE

What it does

Old (Legacy) blocks that perform direct conversion between integer analog value and physical real value in a single step.

When to use it

Only during maintenance of programs migrated from Step 7 Classic.

Pro Tips

SCALE corresponds to FC105 from the old library.

Uses a BIPOLAR parameter to handle negative signals (e.g., +/- 10V).

Systematically prefer NORM_X/SCALE_X for new developments on S7-1200/1500.

Conversion Method Comparison

Choosing the right instruction for your needs

You want to...Recommended instructionExample
Change type (Int -> Real)CONVERTPrecise math with a counter
Remove decimalsTRUNCSimplified temp display
Round mathematicallyROUNDStatistical part calculation
Process a 4-20mA sensorNORM_X + SCALE_X0-16 bar pressure sensor
High safety roundingCEILPallet count calculation
Old S7-300 codeSCALE (FC105)Machine project migration

Frequently Asked Questions

Why use NORM_X and SCALE_X instead of a single block?

This two-step separation allows greater flexibility. For example, you can filter or limit the normalized value (0.0-1.0) before scaling it, or use the same normalized value for several different scales.

What is the standard input value for a Siemens analog input?

For most Siemens modules (S7-1200/1500), the numerical range is 0 to 27648 for a unipolar signal (0-10V or 4-20mA). This is the value you inject into the VALUE parameter of NORM_X.

How to convert a number to a String?

The CONVERT instruction natively handles conversion to String. For more control over formatting (number of decimals), use the VAL_STRG instruction.

What is the difference between ROUND and TRUNC?

ROUND rounds to the nearest integer (10.6 becomes 11), while TRUNC cuts off decimals regardless of their value (10.6 becomes 10).

Optimize your analog calculations

Describe your sensor ranges and conversion needs, T-IA Connect will generate optimized scaling networks with overflow management.