INT
Quick answer
INT is a 16-bit signed PLC integer with the IEC range −32,768 to 32,767. It fits signed 16-bit interfaces, but wider intermediates are safer when subtraction or scaling can exceed that range.
Key Takeaways
- INT is a 16-bit signed PLC integer with the IEC range −32,768 to 32,767. It fits signed 16-bit interfaces, but wider int...
- Beginner-level topic in Data Types & Variables
- Commonly used in: Signed 16-bit analog and protocol values, Bounded setpoints and offsets
- Related to: UINT, DINT, SINT
Detailed Definition
INT stores a signed whole number in 16 bits. Use it when the machine value or interface is explicitly signed and bounded to −32,768 through 32,767. WORD has the same width but is a bit string, while UINT is the unsigned arithmetic interpretation.
Calculate the range of intermediate expressions, not only the final tag. For example, subtracting one valid INT from another can mathematically produce −65,535 or 65,535, which no INT can store. Widen both operands before the subtraction and range-check any later narrowing conversion.
Technical reference
The IEC range is stable; instruction promotion, overflow flags and narrowing outcomes remain runtime-specific.
Reviewed against current primary documentation:
INT PLC Data Type at a glance
- Type family
- Signed integer
- Width
- 16 bits (2 bytes)
- Signedness
- Signed
- Range / values
- −32,768 to 32,767
- IEC-style literal
- INT#-250
- Best fit
- A signed 16-bit device value or a proven bounded quantity
Avoid this type when: Intermediate or lifetime values can exceed ±32,768.
Vendor notation and support boundaries
IEC names help portability, but controller generations, compiler options and instruction signatures still differ.
CODESYS / TwinCAT
The IEC-style type and TYPE#literal form are available. The compiler can reject an out-of-range typed literal, but runtime arithmetic still needs boundary testing.
Siemens SIMATIC
S7-1200 documentation lists the IEC signed and unsigned integer widths used here. Confirm instruction support and conversion behavior for the exact CPU and TIA Portal version.
Rockwell Logix
Current documentation lists unsigned types on 5380/5580-class and newer controllers, while 5370/5570-class controllers list the signed integer family only. Check the controller family before choosing a portable tag type.
IEC-style Structured Text
Avoid overflow in a difference calculation
VAR
Setpoint : INT;
Actual : INT;
Error : DINT;
END_VAR
Error := INT_TO_DINT(Setpoint) - INT_TO_DINT(Actual);Converting both operands before subtraction preserves the full difference between any two valid INT values.
Boundary cases to test
These are mathematical boundaries, not promises about one runtime's failure mode.
| Input / operation | Mathematical result | Safe engineering action |
|---|---|---|
| 32,767 + 1 | 32,768, which is outside INT range. | Use DINT for the operation or explicitly guard the maximum. |
| 32,767 − (−32,768) | 65,535, even though both inputs are valid INT values. | Convert both operands to DINT before subtracting. |
Conversion guidance
- Widen both operands before an expression whose intermediate can exceed INT.
- Range-check DINT before a DINT-to-INT conversion.
- Choose UINT only when negative values are impossible and the target supports it.
- Treat WORD as a bit string and convert explicitly when numeric interpretation is intended.
Before using this type
- 1Calculate minimum and maximum inputs and intermediate results.
- 2Test −32,768, −1, 0, 32,767 and one out-of-range source.
- 3Monitor the controller math-status or diagnostic mechanism.
- 4Verify signed interpretation at every register or network boundary.
Primary technical sources
These sources support the type ranges and platform notes above. The project's controller, firmware and compiler documentation remains authoritative for execution.
- Integer data types
CODESYS Development System — Published ranges, widths and warning about information loss in narrowing conversions.
- Typed literals
Beckhoff Automation — Documents TYPE#literal notation and compile-time loss checks in TwinCAT.
- Studio 5000 elementary data types
Rockwell Automation — Ranges, conversion behavior and controller-family support in current Logix documentation.
- S7-1200 system manual: data types
Siemens — S7-1200 integer widths, ranges and constant examples; verify the manual for the CPU and firmware in use.
Common Questions
What is INT?
INT is a 16-bit signed PLC integer with the IEC range −32,768 to 32,767. It fits signed 16-bit interfaces, but wider intermediates are safer when subtraction or scaling can exceed that range.
When should I use INT?
INT is particularly useful in scenarios such as Signed 16-bit analog and protocol values and Bounded setpoints and offsets. Consider implementing it when you need reliable, efficient solutions for these types of applications.
What should I verify before using INT?
Calculate minimum and maximum inputs and intermediate results. Test −32,768, −1, 0, 32,767 and one out-of-range source. Monitor the controller math-status or diagnostic mechanism. Verify signed interpretation at every register or network boundary.
What are related concepts I should learn?
To fully understand INT, you should also familiarize yourself with UINT, DINT, and SINT. These concepts work together in industrial automation systems.
Continue Learning
Ready to deepen your understanding of INT? Here are some recommended resources:
Was this helpful?
Let us know if this glossary term helped you understand INT better.
Your feedback helps us improve our glossary and create better content for the PLC programming community.
Quick Info
- Category
- Data Types & Variables
- Difficulty
- Beginner
- Tier
- Essential
About Data Types & Variables
Data structures, variable types, and memory organization