This article will show different Conversion Instructions used in the Siemens TIA Portal. The Siemens TIA Portal Conversion blocks are:
S. NO
TYPES OF BLOCKS
FUNCTION
1
CONVERT
The Convert instruction reads the IN, and converts it to the data types specified in the command. The converted value is output at OUT.
2
ROUND
The Round instruction rounds the value at input IN, to the nearest integer. The instruction interprets the value at input IN as a floating-point number and converts it to an integer of data type DINT. The even number is chosen if the input value is exactly between an even and an odd number. The instruction’s output is sent to the OUT.
3
CEIL
The CEIL Instruction generates the next higher integer from a floating-point number instruction to round the value at input IN, to the next higher integer. The instruction interprets the value at the IN input as a floating-point number and converts it to the next higher integer. The output value can be greater than or equal to the input value.
4
FLOOR
The FLOOR Instruction generates the next lowest integer from a floating-point number instruction to round the value at input IN, to the next lowest integer. The instruction interprets the value at the IN input as a floating-point number and converts it to the next lowest integer. The value of the output can be less than or equal to the value of the input.
5
TRUNC
TRUNC is an instruction that converts a numerical value to an integer from the value at the IN input. The IN value is interpreted as a floating-point number. The instruction only sends the integer part of the floating-point number to the OUT, with no decimal places.
6
NORM_X
The NORM_X instruction normalizes and maps the value to a linear scale. The MIN and MAX parameters can be used to define the limits of a value range that is applied to the scale. Depending on the location of the value to be normalized within this value range, the result at the OUT is calculated and stored as a floating-point number. If the value to be normalized equals the value at the MIN input, the OUT value is “0.0”. If the value to be normalized equals the value at input MAX, the value “1.0” is returned by OUT.
7
SCALE_X
The Scale instruction scales the input value and maps it to a given value range. The floating-point value at the input is scaled to the value range defined by the MIN and MAX parameters when the “Scale” instruction is executed. The scaling produces an integer, which is stored in the OUT.
Different CONVERSION Instructions of PLC Ladder Logic used in Siemens TIA Portal
CONV
ROUND
CEIL
FLOOR
TRUNC
NORM_X
SCALE_X
Declaration of Address for Different CONVERSION Instruction
S. No
Operation
Input/Output Address
Input Address
Data type
1
CONVERT
Input
M0.0
Please refer to the below explanation for the data type of each block
Output
Q0.0
2
ROUND
Input
M0.1
Output
Q0.1
3
CEIL
Input
M0.2
Output
Q0.2
4
FLOOR
Input
M0.3
Output
Q0.3
5
TRUNC
Input
M0.4
Output
Q0.4
6
NORM_X
Input
M0.5
Output
Q0.5
7
SCALE_X
Input
M0.6
Output
Q0.6
Working with different CONVERSION Instructions used in the Siemens TIA Portal
The PLC program is created using Siemens TIA Portal V16 software. As stated above, the following Sections explain the various PLC Conversion blocks.
CONV Instruction
The CONV Instruction is used to convert the data from one type to another type directly or indirectly.
The data type for input and output address can be declared based on the reader requirement.
The CONV instruction has EN, IN, ENO, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the CONV instruction.
2
IN
IN stands for Input data. The data type for IN is shown in the below table.
3
ENO
It enables the other instruction connected to CONV instruction
4
OUT
OUT stands for transferred data from IN. The data type for IN is shown in the below table.
ENO
Condition
Result
1
No error
All of the COUNT elements were copied successfully.
0
The source (IN) or destination (OUT) ranges both exceed the available memory area.
Appropriate elements are copied. There are no partial elements copied.
Once the %M0.0 input switch is ON the data from IN is transferred to the OUT.
The OUT can be converted to corresponding data types.
The data type for declaring the IN and OUT is shown below.
The ROUND instruction is used to round the given data to the next integer.
The data type for input and output data type can be declared based on the reader’s requirement.
The ROUND instruction has EN, IN, ENO, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the ROUND instruction.
2
IN
IN stands for Input signal, which is used to assign input data. The data type for IN is shown in the table below.
3
ENO
It enables the other instruction connected to the ROUND instruction.
4
OUT
OUT refers to data that has been transferred from IN. The IN data type is shown in the table below.
Once the %M0.1 input switch is ON the data from IN is converted to the OUT.
The data type for declaring the IN and OUT is shown below
Parameter
Data type
Description
IN
LReal, Real
Various data types of Input and Output
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
CEIL Instruction
The CEIL instruction is used to round the next highest integer.
The data type for input and output data type can be declared based on the reader’s requirement.
The CEIL instruction has EN, IN, ENO, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the CEIL instruction.
2
IN
IN stands for Input signal, which is used to assign input data. The data type for IN is shown in the table below.
3
ENO
It enables the other instruction connected to the CEIL instruction.
4
OUT
OUT refers to data that has been transferred from IN. The IN data type is shown in the table below.
Once the %M0.2 input switch is ON the data from IN is converted to the OUT.
The data type for declaring the IN and OUT is shown below
Parameter
Data type
Description
IN
LReal, Real
Various data types of Input and Output
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
FLOOR Instruction
The FLOOR instruction is used to round the next LOWEST integer.
The data type for input and output data type can be declared based on the reader’s requirement.
The FLOOR instruction has EN, IN, ENO, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the FLOOR instruction.
2
IN
IN stands for Input signal, which is used to assign input data. The data type for IN is shown in the table below.
3
ENO
It enables the other instruction connected to the FLOOR instruction.
4
OUT
OUT refers to data that has been transferred from IN. The IN data type is shown in the table below.
Once the %M0.3 input switch is ON the data from IN is converted to the OUT.
The data type for declaring the IN and OUT is shown below
Parameter
Data type
Description
IN
LReal, Real
Source start address
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Destination start address
TRUNC Instruction
The TRUNC instruction is used to round the next LOWEST integer. It truncates all the values after the decimal. Similar, to Floor Instruction.
The data type for input and output data type can be declared based on the reader’s requirement.
The TRUNC instruction has EN, IN, ENO, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the TRUNC instruction.
2
IN
IN stands for Input signal, which is used to assign input data. The data type for IN is shown in the table below.
3
ENO
It enables the other instruction connected to the TRUNC instruction.
4
OUT
OUT refers to data that has been transferred from IN. The IN data type is shown in the table below.
Once the %M0.4 input switch is ON the data from IN is converted to the OUT.
The data type for declaring the IN and OUT is shown below
Parameter
Data type
Description
IN
LReal, Real
Various data types of Input and Output
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
NORM_X
The NORM_X instruction normalizes the value between the min to max values.
The input value is mapped between min to max and displayed at the output.
The Formula to determine the OUT value of NORM_X instruction is
OUT = (VALUE – MIN) / (MAX – MIN)
The NORM_X instruction has EN, ENO, MIN, VALUE, MAX, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the NORM_X instruction.
2
MIN
MINsignal is used to assign minimum input data that OUT can be calculated. The MIN value is a fixed value.
3
VALUE
VALUE is variable input, using the above formula the OUT-value changes proportionately.
4
MAX
MAXsignal is used to assign maximum input data that OUT can be calculated. The MAX value is a fixed value.
5
ENO
It enables the other instruction connected to the NORM_X instruction.
6
OUT
OUT refers to data that has been calculated from IN. The IN data type is shown in the table below.
Once the %M0.5 input switch is ON the data from VALUE is calculated and displayed to the OUT.
The data type for declaring the MIN, VALUE, MAXM, and OUT is shown below
Parameter
Data type
Description
MIN
INt, SInt, DInt, UDInt, USInt, UInt, Real, LReal
Various data types of Input and Output
VALUE
MAX
OUT
Real, LReal
SCALE_X
The SCALE_X instruction scales the value between the min to max values.
The input value is mapped between min to max and displayed at the output.
The Formula to determine the OUT value of NORM_X instruction is
OUT = [VALUE ∗ (MAX – MIN)] + MIN
The SCALE_X instruction has EN, ENO, MIN, VALUE, MAX, and OUT signals.
S. No
Instruction
Meaning
1
EN
This signal enables the SCALE_X instruction.
2
MIN
MINsignal is used to assign minimum input data that OUT can be calculated. The MIN value is a fixed value.
3
VALUE
VALUE is variable input, using the above formula the OUT-value changes proportionately.
4
MAX
MAXsignal is used to assign maximum input data that OUT can be calculated. The MAX value is a fixed value.
5
ENO
It enables the other instruction connected to the SCALE_X instruction.
6
OUT
OUT refers to data that has been calculated from IN. The IN data type is shown in the table below.
Once the %M0.6 input switch is ON the data from VALUE is calculated and displayed to the OUT.
The data type for declaring the MIN, VALUE, MAXM, and OUT is shown below
Parameter
Data type
Description
MIN
Real, LReal
Various data types of Input and Output
VALUE
MAX
OUT
Real, LReal INt, SInt, DInt, UDInt, USInt, UInt,
The procedures for programming ladder logic on the SIEMENS TIA portal are listed below. (Simulation).
Note: Please see the preceding article for a detailed explanation of how to program ladder logic using the Siemens TIA Portal.
Simulation screenshots of Different CONVERSION Blocks
CONV
The simulation result of the CONV block is shown below
When the input switch is ON the data stored in the input is transferred to the output
The input data is stored in the IN of the CONV block. The input and output address of the CONV Instruction can be declared here. The data declared to each instruction is single data (the data type can be defined by the reader).
In the CONV block corresponding data type is reflected in the output. This way the CONV instruction can be executed and the result can be viewed. The CONV block after the final execution is shown below.
The input and output data type for the CONV instruction is customizable. The reader can change any type of data on the input and output side. (Please refer to the above table for the input and output type). Before declaring the address on the input and output side, the reader should ensure what type of data can be declared on the input and output side.
In the above example, Real is the input data type therefore the address declared on the IN is %MD, and OUT is Int data type the address declared as %MW.
ROUND
The simulation result of the ROUND Instruction is shown below
When the input switch is ON the data in the input is transferred to the output to the next integer.
The input data is stored in the ROUND Instruction. The input and output address of the ROUNDInstruction can be declared in the instruction. The data declared for each instruction is based on reader input. The data is declared as shown below
The ROUND instruction can be executed and the result can be viewed. The ROUNDblock after the final execution is shown below
CEIL
The simulation result of the CEIL block is shown below
When the input switch is ON the data stored in the input is rounded off to the next HIGHEST integer and transferred to the output.
The input and output address can be declared by the reader based on the data type on input and output.
The CEIL instruction can be executed and the result can be viewed. The CEIL block after the final execution is shown below
The reader can see the above two images, the output of both cases is the same. This is due to the instruction CEIL, which always gives the next highest integer (i.e. the decimal value greater than 0.5 or less than 0.5).
FLOOR
The simulation result of the FLOOR block is shown below
When the input switch is ON the data stored in the input is rounded off to the next LOWEST integer and transferred to the output.
The input and output address can be declared by the reader based on the data type on input and output.
The FLOOR instruction can be executed and the result can be viewed. The FLOOR block after the final execution is shown below
The reader can see the above two images, the output of both cases is the same. This is due to the instruction FLOOR, which always gives the next LOWEST integer (i.e. the decimal value greater than 0.5 or less than 0
TRUNC
The simulation result of the TRUNC block is shown below.
When the input switch is ON the data stored in the input is rounded off to the next LOWEST integer and transferred to the output. The reader can change the data type on the input and output side and check for the TRUNC instruction.
The input and output address can be declared by the reader based on the data type on input and output.
The TRUNC instruction can be executed and the result can be viewed. The TRUNC block after the final execution is shown below.
The reader can see the above two images, the output of both cases is the same. This is due to the instruction TRUNC, which always gives the next LOWEST integer (i.e. the decimal value greater than 0.5 or less than 0.5).
NORM_X
The simulation result of the NORM_X block is shown below.
The MIN, MAX, and VALUE are the input of the NORM_X instruction. The MIN & MAX are the fixed values, the data can be set by the reader based on the requirement of the output.
The VALUE is the variable quantity, it can be changed by the reader during the run time (usually the VALUE will be sensor output).
The input and output address can be declared by the reader based on the data type on input and output.
The NORM_X instruction can be executed and the result can be viewed. The NORM_X block after the final execution is shown below.
OUT = (VALUE – MIN) / (MAX-MIN)
Example: MIN = 10; MAX = 30; VALUE = 20
OUT = (20-10)/ (30-10) = 0.5
SCALE_X
The simulation result of the SCALE_X block is shown below.
The MIN, MAX, and VALUE are the input of the SCALE_X instruction. The MIN & MAX are the fixed values, the data can be set by the reader based on the requirement of the output.
The VALUE is the variable quantity, it can be changed by the reader during the run time (usually the VALUE will be sensor output).
The input and output address can be declared by the reader based on the data type on input and output.
The SCALE_X instruction can be executed and the result can be viewed. The SCALE_X block after the final execution is shown below.
OUT = [VALUE ∗ (MAX-MIN)] + MIN
Example: MIN = 5; MAX = 25; VALUE = 0.5
OUT = [0.5 * (25-5)] + 5 = 15
The above exercise will help readers understand how different CONVERSION Instruction work.
With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe
We Noticed You're Using an Ad Blocker Hi there! We understand that ads can be annoying, but they help support our website and allow us to continue providing you with high-quality content. Please consider whitelisting our site or disabling your ad blocker while you visit. Your support means a lot to us! Thank you for understanding!