Home » Converter Instruction in Siemens PLC Programming
PLC Tutorials

Converter Instruction in Siemens PLC Programming

Let’s study the working of converter instruction in Siemens PLC programming using different ladder logics and programs.

Converter Instruction in PLC

Converter Instruction in Siemens PLC Programming

Block Description

Round to double integer:

It reads the input floating point value and converts it to double integer and round to nearest integer. The result is output by the parameter OUT.

Rounding to Nearest Integer in PLC

Truncate double integer part:

It reads the input floating point value and converts it to double integer and round to zero mode. The result is output by the parameter OUT.

Truncate Double Integer Part in PLC Logic

Ceiling:

It reads the input floating point value and converts it to double integer. The result is the lowest integer which is greater than the floating point number i.e  Round to + infinity mode. The result is output by the parameter OUT.

Ceiling Instruction in PLC

Floor:

It reads the input floating point value and converts it to double integer. The result is the greatest integer component which is greater than the floating point number i.e Round to -infinity mode. The result is output by the parameter OUT.

Floor Instruction in PLC

Ladder Logic

PLC Programming Example using Converters

Ladder Description:

Network 1:

If I0.0 is pressed, value in MD0 (99.78) is read as a floating point number and converted to the closest double integer(100). The result of round to integer is stored in MD4(100).

Network 2:

If I0.0 is pressed, value in MD0 (99.78) is read as a floating point number and converted to the double integer. The integer part of the floating point number is the result. The result is stored in MD12 (99).

Network 3:

If I0.0 is pressed, value in MD0 (99.78) is read as a floating point number and converted to the double integer by round function . The result is stored in MD12 (100).

Network 4:

If I0.0 is pressed, value in MD0 (99.78)is read as a floating point number and converted to the double integer by the round to – infinity mode. The result is stored in MD16(99).

Note: For positive numbers, trunc and floor give the same result. But for negative numbers, floor rounds down and trunc rounds up. This is because trunc always rounds toward 0.

Author: Hema Sundaresan

Read Next:

Share With Your Friends

Related Articles

Modbus Communication between PLC and Energy Meter

S Bharadwaj Reddy

Shutdown Motors in Timed Operation PLC Program

S Bharadwaj Reddy

Down Counter PLC Program

S Bharadwaj Reddy

Why is RTO used in the Place of TON Timer?

S Bharadwaj Reddy

PLC Output Types

S Bharadwaj Reddy

How to use Master Control Reset (MCR) Instruction in PLC

S Bharadwaj Reddy

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Converter Instruction in Siemens PLC Programming

WordPress Image Lightbox
Send this to a friend