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 type | Size in bits | Range | Default initial value | |
---|---|---|---|---|
BOOL | Boolean | 1 | TRUE / FALSE | FALSE |
SINT | Short integer | 8 | -128 to 127 | 0 |
INT | Integer | 16 | -32,768 to 32,767 | 0 |
DINT | Double integer | 32 | -2,147,483,648 to 2,147,483,647 | 0 |
LINT | Long integer | 64 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | 0 |
USINT | Unsigned short integer | 8 | 0 to 255 | 0 |
UINT | Unsigned integer | 16 | 0 to 65,535 | 0 |
UDINT | Unsigned double integer | 32 | 0 to 4,294,967,295 | 0 |
ULINT | Unsigned long integer | 64 | 0 to 18,446,744,073,709,551,615 | 0 |
REAL | Real numbers | 32 | -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 |
LREAL | Long real numbers | 64 | ~ -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 |
TIME | Duration | 32 | -24d20h31m23s648ms up to 24d20h31m23s647ms | t#0s |
LTIME | Long duration | 64 | - 106751d23h47m16s854ms775us808ns up to +106751d23h47m16s854ms775us807ns | LTIME#0ns |
BYTE | Bit string of length 8 | 8 | 0 to 255 (16#00...16#FF) | 0 |
WORD | Bit string of length 16 | 16 | 0 to 65,535 (16#00...16#FFFF) | 0 |
DWORD | Bit string of length 32 | 32 | 0 to 4,294,967,295 (16#00....16#FFFFFFFF) | 0 |
LWORD | Bit string of length 64 | 64 | 0 to 18,446,744,073,709,551,615 (16#00....16#FFFFFFFFFFFFFFFF) | 0 |
LDATE / LD | Long date | 64 | min. : 1677-09 -22max. : 2262-04-11 | LDATE#1970-01-01 |
LTIME_OF_DAY / LTOD | Long time of day | 64 | min. : 00:00:00.0max. : 23:59:59.999999999See the note below the table concerning LTOD processing. | LTOD#00:00:00 |
LDATE_AND_TIME / LDT | Long date with time of day | 64 | min. : 1677-09-21-00:12:43.145224192max. : 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:
Byte | Description |
---|---|
STRING data type | |
0...1 | Capacity - Maximum number of characters that the string can hold (from 0 to UINT16.MAX). |
2...3 | Length - 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-1 | Capacity - Maximum number of characters that the string can hold (from 0 to UINT16.MAX). |
2-3 | Length - 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 type | Size in bits | Range | Default initial value | |
---|---|---|---|---|
SAFEBOOL | Safety-related Boolean | 1 | TRUE / FALSE | SAFEFALSE |
SAFEBYTE | Safety-related bit string of length 8 | 8 | 0 to 255 (16#00...16#FF) | SAFEBYTE#0 |
SAFEWORD | Safety-related bit string of length 16 | 16 | 0 to 65,535 (16#00...16#FFFF) | SAFEWORD#0 |
SAFEDWORD | Safety-related bit string of length 32 | 32 | 0 to 4,294,967,295 (16#00....16#FFFFFFFF) | SAFEDWORD#0 |
SAFEINT | Safety-related Integer | 16 | -32,768 to 32,767 | SAFEINT#0 |
SAFEDINT | Safety-related Double Integer | 32 | -2,147,483,648 up to 2,147,483,647 | SAFEDINT#0 |
SAFESINT | Safety-related short integer | 8 | -128...127 | SAFESINT#0 |
SAFEUSINT | Safety-related unsigned short Integer | 8 | 0 up to 255 | SAFEUSINT#0 |
SAFEUINT | Safety-related unsigned Integer | 16 | 0 up to 65,535 | SAFEUINT#0 |
SAFEUDINT | Safety-related unsigned double Integer | 32 | 0 up to 4,294,967,295 | SAFEUDINT#0 |
SAFETIME | Safety-related duration | 32 | 0 to 2,147,483,647 ms(0 to 24 days, 20 hours, 31 minutes, 23 seconds, 647 milliseconds) | SAFETIME#0s |