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
Note:
The LINT data type has limited use on
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers. They can be used only with copy (COP, CPS) instructions, the CST/WallClock Time attribute, time synchronization, and Add-On Instructions.
-9223372036854775808 to 9223372036854775807
DT
Date and time. 64-bit storage; units are in microseconds.
DT#1970-01-01-00:00:00.000_000(UTC+00:00) to DT#2250-12-31-23:59:59.999_999(UTC+00:00)
Tip:
In some time zones, such as Singapore, this is the range:
DT#1970-01-01-08:00:00.000_000(UTC+08:00) to DT#2251-01-01-07:59:59.999_999(UTC+08:00)
LDT
Long date and time. 64-bit storage; units are in nanoseconds.
LDT#1970-01-01-00:00:00.000_000(UTC+00:00) to LDT#2250-12-31-23:59:59.999_999_999(UTC+00:00)
Tip:
In some time zones, such as Singapore, this is the range:
LDT#1970-01-01-08:00:00.000_000_000(UTC+08:00) to LDT#2251-01-01-07:59:59.999_999_999(UTC+08:00)
TIME32
Duration of time. 32-bit storage; units are in microseconds.
T32#-35m_47s_483ms_647us to T32#35m_47s_483ms_647us
TIME
Duration of time. 64-bit storage; units are in microseconds.
T#-106751990d_12h_59m_59s_999ms_999us to T#106751990d_12h_59m_59s_999ms_999us
LTIME
Long duration of time. 64-bit storage; units are in nanoseconds.
LT#-106750d_12h_59m_59s_999ms_999us_999ns to LT#106750d_12h_59m_59s_999ms_999us_999ns
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.4028235E38 to -1.1754944E-38
(negative values)
and
0.0
and
1.1754944E-38 to 3.4028235E38
(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)
These controllers support the following elementary data types:
Controllers
Data type
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580,
Compact GuardLogix
5380, and
GuardLogix
5580 controllers
SINT, INT, DINT, LINT, REAL
USINT, UINT, UDINT, ULINT, LREAL
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
SINT, INT, DINT, LINT, REAL.
The controller handles all immediate values as DINT data types.
The REAL data type also stores Plus or Minus sign infinity and Plus or Minus sign NAN, but the software display differs based on the display format.
Data type conversions
When data types are mixed for operands within an instruction, some instructions automatically convert data to an optimal data type for that instruction. In some cases, the controller converts data to fit a new data type; in some cases, the controller just fits the data as best it can.
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.