Elementary Data Types

Help Contents


Fernhill SCADA supports these elementary data types:

BOOLBoolean value0 or 1
SINTShort integer-128 to +127
USINTUnsigned short integer0 to 255
BYTESingle byte bitmask16#00 to 16#FF
INTInteger-32768 to +32767
UINTUnsigned integer0 to 65535
WORDTwo byte bitmask16#0000 to 16#FFFF
DINTDouble integer-2147483648 to +2147483647
UDINTUnsigned double integer0 to 4294967295
DWORDFour byte bitmask16#00000000 to 16#FFFFFFFF
LINTLong integer-9223372036854775808 to +9223372036854775807
ULINTUnsigned long integer0 to 18446744073709551615
LWORDEight byte bitmask16#0000000000000000 to 16#FFFFFFFFFFFFFFFF
REALSingle precision floating point-
LREALDouble precision floating point-
TIMEInterval value-
DATEDate value1601-01-01 to 9999-12-31
TIME_OF_DAY or TODTime of day00:00:00.000 to 23:59:59.999
DATE_AND_TIME or DTDate and time value1601-01-01-00:00:00.000 to 9999-12-31-23:59:59.999
CHARSingle byte character$00 to $FF
WCHARDouble byte character$0000 to $FFFF
STRINGVariable length single byte character string-
WSTRINGVariable 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:

    (* No size parameter, maximum length is 254 characters *)
    Notes : STRING;

    (* The size parameter sets the length to 4096 characters *)
    SQLCommand : STRING[4096];  

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.

Accessing Characters of a STRING or WSTRING

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:

    State : STRING[16] := 'Stopped';
    Ch : CHAR;

    Ch := State[1];     (* Assigns 'S' to Ch *)
    Ch := State[7];     (* Assigns 'd' to Ch *)

Automatic Type Promotion

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.

Standards Compliance

IEC 61131-3 Second Edition: Table 10.

IEC 61131-3 Third Edition: Table 10.

Further Information

Numeric Literals

To learn about literals to represent numeric values.

Character String Literals

To learn about literals to represent characters and strings.

Date and Time of Day Literals

To learn about literals to represent dates and time of day.

Time Literals

To learn about literals to represent a time interval.

Common Elements

To learn about other language Common Elements.


For the meaning of terms used in Fernhill SCADA.