Elementary data types

The controller supports the elementary data types defined in IEC 1131-3 defined data types. The elementary data types are:
Data type
Description
Range
BOOL
1-bit boolean
0 = cleared
1 = set
SINT
1-byte integer
-128 to 127
INT
2-byte integer
-32,768 to 32,767
DINT
4-byte integer
-2,147,483,648 to 2,147,483,647
LINT
8-byte integer
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
USINT
1-byte unsigned integer
0 to 255
UINT
2-byte unsigned integer
0 to 65,535
UDINT
4-byte unsigned integer
0 to 4,294,967,295
ULINT
8-byte unsigned integer
0 to 18,446,744,073,709,551,615
REAL
4-byte floating-point number
-3.402823E
38
to -1.1754944E
-38
(negative values)
and
0
and
1.1754944E
-38
to 3.402823E
38
(positive values)
LREAL
8-byte floating-point number
-1.7976931348623157E308 to
-2.2250738585072014E-308
(negative values)
and
0.0
and
2.2250738585072014E-308 to
1.7976931348623157E308
(positive values)
The controller handles all immediate values as DINT data types.
Data type conversions
Conversion
Result
Larger integer to smaller integer
The controller truncates the upper portion of the larger integer and generates an overflow.
For example:
Decimal
Binary
DINT
65,665
0000_0000_0000_0001_0000_0000_1000_0001
INT
129
0000_0000_1000_0001
SINT
-127
1000_0001
SINT or INT to REAL
No data precision is lost
DINT to REAL
Data precision could be lost. Both data types store data in 32 bits, but the REAL type uses some of its 32 bits to store the exponent value. If precision is lost, the controller takes it from the least-significant portion of the DINT.
LREAL to LREAL
No data precision is lost.
LREAL TO REAL
Data precision could be lost.
LREAL/REAL to unsigned integer
Data precision could be lost. If the source value is too big to fit into destination the controller stores what it can and may produce an overflow.
Signed Integer/Unsigned Integer to LREAL/REAL
If the integer value has more significant bits than can be stored in the destination, the lower bits will be truncated.
Signed integer to unsigned integer
If the source value is too big to fit into destination, the controller stores what it can and may produce an overflow.
Unsigned integer to signed integer
If the source value is too big to fit into destination, the controller stores what it can and may produce an overflow.
REAL to integer
The controller rounds the fractional part and truncates the upper portion of the non-fractional part. If data is lost, the controller sets the overflow status flag.
Rounding is to the nearest whole number:
less than 0.5, round down; equal to 0.5, round to nearest even integer; greater than 0.5, round up
For example:
REAL (source)
DINT (result)
1.6
2
-1.6
-2
1.5
2
-1.5
-2
1.4
1
-1.4
-1
2.5
2
-2.5
-2
Do not convert data to or from the BOOL data type.
IMPORTANT: The math status flags are set based on the value being stored. Instructions that normally do not affect math status keywords might appear to do so if type conversion occurs because of mixed data types for the instruction parameters. The type conversion process sets the math status keywords.
Safety Data Types
The
Logix Designer
application prevents the modification of a User Defined or Add-On Defined type that would cause an invalid data type for User Defined or Add-On Defined types that are referenced directly or indirectly by a Safety tag. (This includes nested structures.)
Safety tags can be composed of the following data types:
  • All elementary data types.
  • Predefined types that are used for safety application instructions.
  • User-defined data types or arrays that are composed of the previous two types.
Online edits of user-defined data type member names in safety tags
Online editing is allowed for member names of user-defined data types on
CompactLogix
5380,
Compact GuardLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers. However, online editing is disabled when a user-defined data type is used on a safety tag and the controller is in the Safety Secured state.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.