INT_TO_REAL (Integer to Real Conversion)
Converts 16-bit integer to 32-bit floating-point real value.
The INT_TO_REAL function converts an integer value (INT, 16-bit signed) to a floating-point real value (REAL, 32-bit IEEE 754). This conversion is essential when integer values from counters, analog inputs (raw counts), or recipe parameters need to be used in floating-point calculations such as PID control, scaling, or engineering unit conversions. The conversion is always exact for INT values since REAL has sufficient precision to represent all INT values.
Parameters
Inputs
| Name | Type | Description |
|---|---|---|
| IN | INT | Integer value to convert (-32768 to 32767) |
Outputs
| Name | Type | Description |
|---|---|---|
| OUT | REAL | Floating-point equivalent |
Ladder Logic Example
// Ladder Logic - INT_TO_REAL (Analog Scaling) // // |----[INT_TO_REAL]----[DIV]----[MUL]----| // | IN: Analog_Raw Scale calculation | // | OUT: Raw_Real for engineering |
Structured Text Example
// Convert raw analog (0-27648) to engineering units Raw_Real := INT_TO_REAL(Analog_Raw); Temperature := (Raw_Real / 27648.0) * 100.0; // 0-27648 raw -> 0.0-100.0 degrees
20 Production-Ready Ladder Logic Templates
Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.
Platform-Specific Implementation
Siemens (TIA Portal)
Use CONVERT instruction or INT_TO_REAL in TIA Portal SCL.
Allen-Bradley (Studio 5000)
Implicit conversion in most cases, or use COP instruction.
CODESYS
Use INT_TO_REAL() function in ST. Automatic in some contexts.
Common Applications
- Analog input scaling
- Counter value in calculations
- Recipe parameter conversion
- PID input preparation
- HMI display formatting
Frequently Asked Questions
What is INT_TO_REAL (Integer to Real Conversion) in PLC programming?
Converts 16-bit integer to 32-bit floating-point real value. The INT_TO_REAL function converts an integer value (INT, 16-bit signed) to a floating-point real value (REAL, 32-bit IEEE 754). This conversion is essential when integer values from counters, analog inputs (raw counts), or recipe parameters need to be used in floating-point calculations such as PID control, scaling, or engineering unit conversions.
What are common applications of INT_TO_REAL (Integer to Real Conversion)?
INT_TO_REAL (Integer to Real Conversion) is commonly used for: Analog input scaling, Counter value in calculations, Recipe parameter conversion, PID input preparation, HMI display formatting.
How do I use INT_TO_REAL (Integer to Real Conversion) in different PLC platforms?
Siemens: Use CONVERT instruction or INT_TO_REAL in TIA Portal SCL. Allen-Bradley: Implicit conversion in most cases, or use COP instruction. CODESYS: Use INT_TO_REAL() function in ST. Automatic in some contexts.
Related Function Blocks
REAL_TO_INT (Real to Integer Conversion)
Converts 32-bit floating-point value to 16-bit integer with rounding.
View Reference →BOOL_TO_INT (Boolean to Integer Conversion)
Converts FALSE to 0 and TRUE to 1 for numeric operations.
View Reference →INT_TO_STRING (Integer to String Conversion)
Converts integer value to its decimal string representation for display or logging.
View Reference →ANY_TO_ANY (Universal Type Conversion)
General type conversion framework covering all IEC 61131-3 type conversion functions.
View Reference →Stop Writing Ladder Logic From Scratch
Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.
Instant download - 30-day money-back guarantee - Use on unlimited projects