Fernhill SCADA supports these elementary data types:
Keyword | Description | Range |
---|---|---|
BOOL | Boolean value | 0 or 1 |
SINT | Short integer | -128 to +127 |
USINT | Unsigned short integer | 0 to 255 |
BYTE | Single byte bitmask | 16#00 to 16#FF |
INT | Integer | -32768 to +32767 |
UINT | Unsigned integer | 0 to 65535 |
WORD | Two byte bitmask | 16#0000 to 16#FFFF |
DINT | Double integer | -2147483648 to +2147483647 |
UDINT | Unsigned double integer | 0 to 4294967295 |
DWORD | Four byte bitmask | 16#00000000 to 16#FFFFFFFF |
LINT | Long integer | -9223372036854775808 to +9223372036854775807 |
ULINT | Unsigned long integer | 0 to 18446744073709551615 |
LWORD | Eight byte bitmask | 16#0000000000000000 to 16#FFFFFFFFFFFFFFFF |
REAL | Single precision floating point | - |
LREAL | Double precision floating point | - |
TIME | Interval value | - |
DATE | Date value | 1601-01-01 to 9999-12-31 |
TIME_OF_DAY or TOD | Time of day | 00:00:00.000 to 23:59:59.999 |
DATE_AND_TIME or DT | Date and time value | 1601-01-01-00:00:00.000 to 9999-12-31-23:59:59.999 |
CHAR | Single byte character | $00 to $FF |
WCHAR | Double byte character | $0000 to $FFFF |
STRING | Variable length single byte character string | - |
WSTRING | Variable length double byte character string | - |
The STRING and WSTRING types store a variable number of characters up to a maximum limit.
STRING and WSTRING types can be declared with or without a size parameter. For example:
VAR (* No size parameter, maximum length is 254 characters *) Notes : STRING; (* The size parameter sets the length to 4096 characters *) SQLCommand : STRING[4096]; END_VAR
The maximum length of the STRING and WSTRING types declared without a size parameter is 254 characters.
The size parameter of a string must be in the range 1 to 65535.
Use the array index operator [] to access a character of a string type. The index in the array operator starts at position 1. For example:
VAR State : STRING[16] := 'Stopped'; Ch : CHAR; END_VAR Ch := State[1]; (* Assigns 'S' to Ch *) Ch := State[7]; (* Assigns 'd' to Ch *)
Elementary Types have a priority defined by the position in the above table. For example type REAL is higher priority than type INT.
When two different types are used in an operation automatic type promotion occurs. The inputs to the operation are all promoted to the same type as the highest priority input. For example if an INT is added to a REAL, the INT value is promoted to a REAL before the addition operation. The return value from this operation will be REAL.
IEC 61131-3 Second Edition: Table 10.
IEC 61131-3 Third Edition: Table 10.
To learn about literals to represent numeric values.
To learn about literals to represent characters and strings.
To learn about literals to represent dates and time of day.
To learn about literals to represent a time interval.
To learn about other language Common Elements.
For the meaning of terms used in Fernhill SCADA.