-

Data Types: Generic and Elementary

This topic lists the following data types:

Generic data types

Generic data types are data types which include hierarchical groups of elementary data types. For example, ANY_INT includes the elementary data types SINT, DINT, INT, LINT, USINT, UINT, UDINT, and ULINT. If a function can be connected with ANY_INT, it means that variables of these data types can be handled.

Generic data types are organized as follows:

Generic safety-related data types

Generic data types are data types which include hierarchical groups of elementary data types. The generic data type ANY_SAFEBIT, for example, includes the elementary data types SAFEDWORD, SAFEWORD, SAFEBYTE and SAFEBOOL. If a function can be connected with ANY_SAFEBIT, it means that variables of these data types can be handled.

Generic safety-related data types are organized as follows:

Elementary data types

Data type1Size in bitsRangeDefault initial value
BOOLBoolean1TRUE / FALSEFALSE
SINTShort integer8-128 to 1270
INTInteger16-32,768 to 32,7670
DINTDouble integer32-2,147,483,648 to 2,147,483,6470
LINTLong integer64-9,223,372,036,854,775,808 to 9,223,372,036,854,775,8070
USINTUnsigned short integer80 to 2550
UINTUnsigned integer160 to 65,5350
UDINTUnsigned double integer320 to 4,294,967,2950
ULINTUnsigned long integer640 to 18,446,744,073,709,551,6150
REALReal numbers32-3.402823466 E+38 (approx. 7 digits)
to
-1.175494351 E-38 (approx. 7 digits)

and

+1.175494351 E-38 (approx. 7 digits)
to
+3.402823466 E+38 (approx. 7 digits)

See the note below the table concerning REAL and LREAL processing.
0.0
LREALLong real numbers64~ -1.798 E+308 (approx. 15 digits)
to
~ -2.225 E-308 (approx. 15 digits)

and

~ +2.225 E-308 (approx. 15 digits)
to
~ +1.798 E+308 (approx. 15 digits)

See the note below the table concerning REAL and LREAL processing.
0.0
TIMEDuration32-24d20h31m23s648ms up to 24d20h31m23s647mst#0s
LTIMELong duration64- 106751d23h47m16s854ms775us808ns up to +106751d23h47m16s854ms775us807nsLTIME#0ns
BYTEBit string of length 880 to 255
(16#00...16#FF)
0
WORDBit string of length 16160 to 65,535
(16#00...16#FFFF)
0
DWORDBit string of length 32320 to 4,294,967,295
(16#00....16#FFFFFFFF)
0
LWORDBit string of length 64640 to 18,446,744,073,709,551,615
(16#00....16#FFFFFFFFFFFFFFFF)
0
LDATE / LDLong date64min. : 1677-09 -22

max. : 2262-04-11
LDATE#1970-01-01
LTIME_OF_DAY / LTODLong time of day64min. : 00:00:00.0

max. : 23:59:59.999999999

See the note below the table concerning LTOD processing.
LTOD#00:00:00
LDATE_AND_TIME / LDTLong date with time of day64min. : 1677-09-21-00:12:43.145224192

max. : 2262-04-11-23:47:16.854775807
LDT#1970-01-01-00:00:00

Note
If you are using PLCnext Engineer in another user interface language and/or with another Windows system locale than English you must enter numeric values with a '.' as decimal separator (always according to the English standard). This applies, for example, when entering initial values in variables tables or REAL/LREAL literals in the code.

Note
Processing of REAL and LREAL data types
There is a limited accuracy when processing REAL and LREAL data types. This is caused by the characteristics of the processor architecture and the data type definition according to IEEE. This applies to the positive and also the negative value range.

Note
Processing of LTOD data type
In the event of an overflow (min or max value for the LTOD data type exceeded), the LTOD value is interpreted and displayed as time value in nanoseconds ("xxxxx ns").

Data types STRING and WSTRING
The data types STRING (single byte string) and WSTRING (double byte string) are also elementary data types but do not belong to the above mentioned group. The data types STRING and WSTRING have the following structure:

ByteDescription
STRING data type
0...1Capacity - Maximum number of characters that the string can hold (from 0 to UINT16.MAX).
2...3Length - Current number of characters in the string (from 0 to Capacity).
4...84
(for an 80 characters string)

4...124
(for a user-defined string of 120 characters)
String of ANSI characters followed by a trailing zero character. Each character is represented by one byte.
WSTRING data type
0-1Capacity - Maximum number of characters that the string can hold (from 0 to UINT16.MAX).
2-3Length - Current number of characters in the string (from 0 to Capacity).
4...165
(for an 80 characters string)

4...245
(for a user-defined string of 120 characters)
String of UTF16 characters followed by a trailling zero character. Each character is represented by two bytes or, for some language characters, by four bytes.

Elementary safety-related data types

Data type1Size in bitsRangeDefault initial value
SAFEBOOLSafety-related Boolean1TRUE / FALSESAFEFALSE
SAFEBYTESafety-related bit string of length 880 to 255
(16#00...16#FF)
SAFEBYTE#0
SAFEWORDSafety-related bit string of length 16160 to 65,535
(16#00...16#FFFF)
SAFEWORD#0
SAFEDWORDSafety-related bit string of length 32320 to 4,294,967,295
(16#00....16#FFFFFFFF)
SAFEDWORD#0
SAFEINTSafety-related Integer16-32,768 to 32,767SAFEINT#0
SAFEDINTSafety-related Double Integer32-2,147,483,648 up to 2,147,483,647SAFEDINT#0
SAFESINTSafety-related short integer8-128...127SAFESINT#0
SAFEUSINTSafety-related unsigned short Integer80 up to 255SAFEUSINT#0
SAFEUINTSafety-related unsigned Integer160 up to 65,535SAFEUINT#0
SAFEUDINTSafety-related unsigned double Integer320 up to 4,294,967,295SAFEUDINT#0
SAFETIMESafety-related duration320 to 2,147,483,647 ms

(0 to 24 days, 20 hours, 31 minutes, 23 seconds, 647 milliseconds)
SAFETIME#0s