IEC 61131-3 Standard Functions
This paragraph is a reference of all IEC 61131-3 standard functions available in GF_ProjectVX code, along with a few others, which may be considered as GF_ProjectVX code’s extensions to the standard.These functions are common to the whole set of programming languages and can therefore be used in any Programmable Organization Unit (POU).A function specified in this paragraph to be extensible (Ext.) is allowed to have a variable number of inputs.Type Conversion FunctionsAccording to the IEC 61131-3 standard, type conversion functions shall have the form *_TO_**, where “*” is the type of the input variable, and “**” the type of the output variable (for example, INT_TO_REAL). GF_ProjectVX code provides a more convenient set of overloaded type conversion functions, relieving the developer to specify the input variable type.
Numerical FunctionsThe availability of the following functions depends on the target device. Please refer to your hardware supplier for details.
*: function provided as extension to the IEC 61131-3 standard.Bit String Functions
Selection Functions
Comparison FunctionsComparison functions can be also used to compare strings if this feature is supported by target device.
String FunctionsThe availability of the following functions depends on the target device. Please refer to your hardware supplier for details.
Standard operators
TO_BOOL | TO_BOOL |
Description | Conversion to BOOL (Boolean) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | BOOL |
Examples | out := TO_BOOL( 0 ); (* out = FALSE *)out := TO_BOOL( 1 ); (* out = TRUE *)out := TO_BOOL( 1000 ); (* out = TRUE *) |
TO_BYTE | TO_BYTE |
Description | Conversion to BYTE (8-bit string) |
Number of operands | 1 |
Input data type | Any numerical type or STRING |
Output data type | BYTE |
Examples | out := TO_BYTE( -1 ); (* out = 16#FF *)out := TO_BYTE( 16#100 ); (* out = 16#00 *) |
TO_DATE | TO_DATE |
Description | Conversion to DATE (32-bit signed integer) |
Number of operands | 1 |
Input data type | DATE_AND_TIME, LDATE_AND_TIME, LDATE |
Output data type | DATE |
Examples |
TO_DATE_AND_TIME | TO_DATE_AND_TIME |
Description | Conversion to DATE_AND_TIME (32-bit signed integer) |
Number of operands | 1 |
Input data type | LDATE_AND_TIME |
Output data type | DATE_AND_TIME |
Examples |
TO_DINT | TO_DINT |
Description | Conversion to DINT (32-bit signed integer) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | DINT |
Examples | out := TO_DINT( 10.0 ); (* out = 10 *)out := TO_DINT( 16#FFFFFFFF ); (* out = -1 *) |
TO_DWORD | TO_DWORD |
Description | Conversion to DWORD (32-bit string) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | DWORD |
Examples | out := TO_DWORD( 10.0 ); (* out = 16#0000000A *)out := TO_DWORD( -1 ); (* out = 16#FFFFFFFF *) |
TO_INT | TO_INT | TO_INT |
Description | Conversion to INT (16-bit signed integer) | |
Number of operands | 1 | |
Input data type | Any numerical type | |
Output data type | INT | |
Examples | out := TO_INT( -1000.0 ); (* out = -1000 *)out := TO_INT( 16#8000 ); (* out = -32768 *) |
TO_LDATE | TO_LDATE |
Description | Conversion to LDATE (64-bit signed integer) |
Number of operands | 1 |
Input data type | DATE_AND_TIME, LDATE_AND_TIME, DATE |
Output data type | LDATE |
Examples |
TO_LDATE_AND_TIME | TO_LDATE_AND_TIME |
Description | Conversion to LDATE_AND_TIME (64-bit signed integer) |
Number of operands | 1 |
Input data type | DATE_AND_TIME |
Output data type | LDATE_AND_TIME |
Examples |
TO_LINT | TO_LINT | TO_LINT |
Description | Conversion to LINT (64-bit signed integer) | |
Number of operands | 1 | |
Input data type | Any numerical type or STRING | |
Output data type | LINT | |
Examples | out := TO_LINT( -1 ); (* out = -1 *)out := TO_LINT(16#FFFFFFFFFFFFFFFF); (* out = -1 *) |
TO_LREAL | TO_LREAL | TO_LREAL |
Description | Conversion to LREAL (64-bit floating point) | |
Number of operands | 1 | |
Input data type | Any numerical type or STRING | |
Output data type | LREAL | |
Examples | out := TO_LREAL( -1000 ); (* out = -1000.0 *)out := TO_LREAL( 16#8000 ); (* out = -32768.0 *) |
TO_LTIME | TO_LTIME |
Description | Conversion to LTIME (64-bit signed integer) |
Number of operands | 1 |
Input data type | TIME |
Output data type | LTIME |
Examples |
TO_LTIME_OF_DAY | TO_LTIME_OF_DAY |
Description | Conversion to LTIME (64-bit signed integer) |
Number of operands | 1 |
Input data type | TIME_OF_DAY, DATE_AND_TIME, LDATE_AND_TIME |
Output data type | LTIME_OF_DAY |
Examples |
TO_LWORD | TO_LWORD |
Description | Conversion to LWORD (64-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type or STRING |
Output data type | LWORD |
Examples | out := TO_LWORD( 10.0 ); (* out =16#000000000000000A *)out := TO_LWORD( -1 ); (* out = 16#FFFFFFFFFFFFFFFF*) |
TO_POINTER | TO_POINTER |
Description | Conversion to pointer |
Number of operands | 1 |
Input data type | Any numerical type or STRING |
Output data type | UNDEFINED |
Examples | out := TO_POINTER( example_var ); |
TO_REAL | TO_REAL |
Description | Conversion to REAL (32-bit floating point) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | REAL |
Examples | out := TO_REAL( -1000 ); (* out = -1000.0 *)out := TO_REAL( 16#8000 ); (* out = -32768.0 *) |
TO_SINT | TO_SINT |
Description | Conversion to SINT (8-bit signed integer) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | SINT |
Examples | out := TO_SINT( -1 ); (* out = -1 *)out := TO_SINT( 16#100 ); (* out = 0 *) |
TO_STRING | TO_STRING |
Description | Conversion to STRING |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | STRING |
Examples | str := TO_STRING( 10.0 ); (* str = ‘10,0’ *)str := TO_STRING( -1 ); (* str = ‘-1’ *) |
TO_TIME | TO_TIME |
Description | Conversion to LTIME (32-bit signed integer) |
Number of operands | 1 |
Input data type | LTIME |
Output data type | TIME |
Examples |
TO_TIME_OF_DAY | TO_TIME_OF_DAY |
Description | Conversion to TIME_OF_DAY (32-bit signed integer) |
Number of operands | 1 |
Input data type | LTIME_OF_DAY, DATE_AND_TIME, LDATE_AND_TIME |
Output data type | TIME_OF_DAY |
Examples |
TO_UDINT | TO_UDINT |
Description | Conversion to UDINT (32-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | UDINT |
Examples | out := TO_UDINT( 10.0 ); (* out = 10 *)out := TO_UDINT( 16#FFFFFFFF ); (* out = 4294967295 *) |
TO_UINT | TO_UINT |
Description | Conversion to UINT (16-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | UINT |
Examples | out := TO_UINT( 1000.0 ); (* out = 1000 *)out := TO_UINT( 16#8000 ); (* out = 32768 *) |
TO_ULINT | TO_ULINT |
Description | Conversion to ULINT (64-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type or STRING |
Output data type | ULINT |
Examples | out := TO_ULINT( 10.0 ); (* out = 10 *)out := TO_ULINT( 16#FFFFFFFFFFFFFFFF ); (* out = 18446744073709551615 *) |
TO_USINT | TO_USINT |
Description | Conversion to USINT (8-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | USINT |
Examples | out := TO_USINT( -1 ); (* out = 255 *)out := TO_USINT( 16#100 ); (* out = 0 *) |
TO_WORD | TO_WORD |
Description | Conversion to WORD (16-bit unsigned integer) |
Number of operands | 1 |
Input data type | Any numerical type or STRING |
Output data type | WORD |
Examples | out := TO_WORD( 1000.0 ); (* out = 16#03E8 *)out := TO_WORD( -32768 ); (* out = 16#8000 *) |
TO_WSTRING | TO_WSTRING |
Description | Conversion to WSTRING |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | WSTRING |
Examples | wstr := TO_STRING( 10.0 ); (* wstr = “10,0” *)wstr := TO_STRING( -1 ); (* wstr = “-1” *) |
ABS | ABS |
Description | Absolute value. Computes the absolute value of input #0 |
Number of operands | 1 |
Input data type | Any numerical type |
Output data type | Same as input |
Examples | OUT := ABS( -5 );(* OUT = 5 *)OUT := ABS( -1.618 );(* OUT = 1.618 *)OUT := ABS( 3.141592 );(* OUT = 3.141592 *) |
ACOS | ACOS |
Description | Arc cosine. Computes the principal arc cosine of input #0; result is expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := ACOS( 1.0 ); (* OUT = 0.0 *)OUT := ACOS( -1.0 ); (* OUT = PI *) |
ADD | ADD |
Description | Arithmetic addition. Computes the sum of the two inputs. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := ADD( 20, 40 ); (* OUT = 60 *) |
ASIN | ASIN |
Description | Arc sine. Computes the principal arc sine of input #0; result is expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := ASIN( 0.0 ); (* OUT = 0.0 *)OUT := ASIN( 1.0 ); (* OUT = PI / 2 *) |
ATAN | ATAN |
Description | Arc tangent. Computes the principal arc tangent of input #0; result is expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := ATAN( 0.0 ); (* OUT = 0.0 *)OUT := ATAN( 1.0 ); (* OUT = PI / 4 *) |
ATAN2* | ATAN2* |
Description | Arc tangent (with 2 parameters). Computes the principal arc tangent of Y/X; result is expressed in radians |
Number of operands | 2 |
Input data type | LREAL where available, REAL otherwise;LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := ATAN2( 0.0, 1.0 ); (* OUT = 0.0 *)OUT := ATAN2( 1.0, 1.0 ); (* OUT = PI / 4 *)OUT := ATAN2( -1.0, -1.0 ); (* OUT = ( -3/4 ) * PI *)OUT := ATAN2( 1.0, 0.0 ); (* OUT = PI / 2 *) |
CEIL* | CEIL* |
Description | Rounding up to integer. Returns the smallest integer that is greater than or equal to input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := CEIL( 1.95 ); (* OUT = 2.0 *)OUT := CEIL( -1.27 ); (* OUT = -1.0 *) |
COS | COS |
Description | Cosine. Computes the cosine function of input #0 expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := COS( 0.0 ); (* OUT = 1.0 *)OUT := COS( -3.141592 ); (* OUT ~ -1.0 *) |
COSH* | COSH* |
Description | Hyperbolic cosine. Computes the hyperbolic cosine function of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := COSH( 0.0 ); (* OUT = 1.0 *) |
DIV | DIV |
Description | Arithmetic division. Divides input #0 by input #1 |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := DIV( 20, 2 ); (* OUT = 10 *) |
EXP | EXP |
Description | Natural exponential. Computes the exponential function of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := EXP( 1.0 ); (* OUT ~ 2.718281 *) |
FLOOR* | FLOOR* |
Description | Rounding down to integer. Returns the largest integer that is less than or equal to input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := FLOOR( 1.95 ); (* OUT = 1.0 *)OUT := FLOOR( -1.27 ); (* OUT = -2.0 *) |
LN | LN |
Description | Natural logarithm. Computes the logarithm with base e of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := LN( 2.718281 ); (* OUT = 1.0 *) |
LOG | LOG |
Description | Logarithm. Computes the logarithm with base 10 of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := LOG( 100.0 );(* OUT = 2.0 *) |
MOD | MOD |
Description | Module. Computes input #0 module input #1 |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := MOD( 10, 3 ); (* OUT = 1 *) |
MUL | MUL |
Description | Arithmetic multiplication. Multiplies the two inputs. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := MUL( 10, 10 ); (* OUT = 100 *) |
POW | POW |
Description | Exponentiation. Raises Base to the power Expo |
Number of operands | 2 |
Input data type | LREAL where available, REAL otherwiseLREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := POW( 2.0, 3.0 ); (* OUT = 8.0 *)OUT := POW( -1.0, 5.0 ); (* OUT = -1.0 *) |
SIN | SIN |
Description | Sine. Computes the sine function of input #0 expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := SIN( 0.0 ); (* OUT = 0.0 *)OUT := SIN( 2.5 * 3.141592 ); (* OUT ~ 1.0 *) |
SINH* | SINH* |
Description | Hyperbolic sine. Computes the hyperbolic sine function of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := SINH( 0.0 ); (* OUT = 0.0 *) |
SQRT | SQRT |
Description | Square root. Computes the square root of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := SQRT( 4.0 ); (* OUT = 2.0 *) |
SUB | SUB |
Description | Arithmetic subtraction. Subtracts input #1 from input #0 |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := SUB( 10, 3 ); (* OUT = 7 *) |
TAN | TAN |
Description | Tangent. Computes the tangent function of input #0 expressed in radians |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := TAN( 0.0 ); (* OUT = 0.0 *)OUT := TAN( 3.141592 / 4.0 ); (* OUT ~ 1.0 *) |
TANH* | TANH* |
Description | Hyperbolic tangent. Computes the hyperbolic tangent function of input #0 |
Number of operands | 1 |
Input data type | LREAL where available, REAL otherwise |
Output data type | LREAL where available, REAL otherwise |
Examples | OUT := TANH( 0.0 ); (* OUT = 0.0 *) |
AND | AND |
Description | Logical AND if both Input #0 and Input #1 are BOOL, otherwise bitwise AND. |
Number of operands | 2 |
Input data type | Any but STRING, Any but STRING |
Output data type | Same as Inputs |
Examples | OUT := TRUE AND FALSE; (* OUT = FALSE *)OUT := 16#1234 AND 16#5678; (* OUT = 16#1230 *) |
NOT | NOT |
Description | Logical NOT if Input is BOOL, otherwise bitwise NOT. |
Number of operands | 1 |
Input data type | Any but STRING |
Output data type | Same as Inputs |
Examples | OUT := NOT FALSE; (* OUT = TRUE *)OUT := NOT 16#1234;(* OUT = 16#EDCB *) |
OR | OR |
Description | Logical OR if both Input #0 and Input #1 are BOOL, otherwise bitwise OR. |
Number of operands | 2 |
Input data type | Any but STRING, Any but STRING |
Output data type | Same as Inputs |
Examples | OUT := TRUE OR FALSE; (* OUT = FALSE *)OUT := 16#1234 OR 16#5678;(* OUT = 16#567C *) |
R | R |
Description | Reset operator: reset input to 0 |
Number of operands | 1 |
Input data type | BOOL |
Output data type | Same as Inputs #0 |
Examples |
ROL | ROL |
Description | Input #0 left-shifted of Input #1 bits, circular. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Input #0 |
Examples | OUT := ROL( IN := 16#1000CAFE, 4 );(* OUT = 16#000CAFE1 *) |
ROR | ROR |
Description | Input #0 right-shifted of Input #1 bits, circular. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Input #0 |
Examples | OUT := ROR( IN := 16#1000CAFE, 16 );(* OUT = 16#CAFE1000 *) |
S | S |
Description | Set operator: set input to 1 |
Number of operands | 1 |
Input data type | BOOL |
Output data type | Same as Inputs #0 |
Examples |
SHL | SHL |
Description | Input#0 left-shifted of Input #1 bits, zero filled on the right. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Input #0 |
Examples | OUT := SHL( IN := 16#1000CAFE, 16 );(* OUT = 16#CAFE0000 *) |
SHR | SHR |
Description | Input #0 right-shifted of Input #1 bits, zero filled on the left. |
Number of operands | 2 |
Input data type | Any numerical type, Any numerical type |
Output data type | Same as Input #0 |
Examples | OUT := SHR( IN := 16#1000CAFE, 24 );(* OUT = 16#00000010 *) |
XOR | XOR |
Description | Logical XOR if both Input #0 and Input #1 are BOOL, otherwise bitwise XOR. |
Number of operands | 2 |
Input data type | Any but STRING, Any but STRING |
Output data type | Same as Inputs |
Examples | OUT := TRUE OR FALSE; (* OUT = TRUE *)OUT := 16#1234 OR 16#5678; (* OUT = 16#444C *) |
LIMIT | LIMIT |
Description | Limits Input #0 to be equal or more than Input#1, and equal or less than Input #2. |
Number of operands | 3 |
Input data type | Any numerical type, Any numerical type, Any numerical type |
Output data type | Same as Inputs |
Examples | OUT := LIMIT( IN := 4, MN := 0, MX := 5 ); (* OUT = 4 *) OUT := LIMIT( IN := 88, MN := 0, MX := 5 );(* OUT = 5 *)OUT := LIMIT( IN := -1, MN := 0, MX := 5 );(* OUT = 0 *) |
MAX | MAX |
Description | Maximum value selection |
Number of operands | 2, extensible |
Input data type | Any numerical type, Any numerical type, …, Any numerical type |
Output data type | Same as max Input |
Examples | OUT := MAX( -8, 120, -1000 ); (* OUT = 120 *) |
MIN | MIN |
Description | Minimum value selection |
Number of operands | 2, extensible |
Input data type | Any numerical type, Any numerical type, …, Any numerical type |
Output data type | Same as min Input |
Examples | OUT := MIN( -8, 120, -1000 ); (* OUT = -1000 *) |
MUX | MUX |
Description | Multiplexer. Selects one of N inputs depending on input K |
Number of operands | 3, extensible |
Input data type | Any numerical type, Any numerical type, …, Any numerical type |
Output data type | Same as selected Input |
Examples | OUT := MUX( 0, A, B, C ); (* OUT = A *) |
SEL | SEL |
Description | Binary selection |
Number of operands | 3 |
Input data type | BOOL, Any, Any |
Output data type | Same as selected Input |
Examples | OUT := SEL( G := FALSE, IN0 := X, IN1 := 5 );(* OUT = X *) |
EQ | EQ |
Description | Equal to. Returns TRUE if Input #0 = Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any, Any |
Output data type | BOOL |
Examples | OUT := EQ( TRUE, FALSE ); (* OUT = FALSE *)OUT := EQ( ‘goofy’, ‘pluto’ ); (* OUT = FALSE *) |
GE | GE |
Description | Greater than or equal to. Returns TRUE if Input #0 >= Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any but BOOL, Any but BOOL |
Output data type | BOOL |
Examples | OUT := GE( 20, 20 ); (* OUT = TRUE *)OUT := GE( ‘goofy’, ‘pluto’ ); (* OUT = FALSE *) |
GT | GT |
Description | Greater than. Returns TRUE if Input #0 > Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any but BOOL, Any but BOOL |
Output data type | BOOL |
Examples | OUT := GT( 0, 20 ); (* OUT = FALSE *)OUT := GT( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *) |
LE | LE |
Description | Less than or equal to. Returns TRUE if Input #0 <= Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any but BOOL, Any but BOOL |
Output data type | BOOL |
Examples | OUT := LE( 20, 20 ); (* OUT = TRUE *)OUT := LE( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *) |
LT | LT |
Description | Less than. Returns TRUE if Input #0 < Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any but BOOL, Any but BOOL |
Output data type | BOOL |
Examples | OUT := LT( 0, 20 ); (* OUT = TRUE *)OUT := LT( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *) |
NE | NE |
Description | Not equal to. Returns TRUE if Input #0 != Input #1, otherwise FALSE. |
Number of operands | 2 |
Input data type | Any, Any |
Output data type | BOOL |
Examples | OUT := NE( TRUE, FALSE ); (* OUT = TRUE *)OUT := NE( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *) |
CONCAT | CONCAT |
Description | Character string concatenation |
Number of operands | 2 |
Input data type | STRING, STRING |
Output data type | STRING |
Examples | OUT := CONCAT( ‘AB’, ‘CD’ ); (* OUT = ‘ABCD’ *) |
DELETE | DELETE |
Description | Delete L characters of IN, beginning at the P-th character position |
Number of operands | 3 |
Input data type | STRING, UINT, UINT |
Output data type | STRING |
Examples | OUT := DELETE( IN := ‘ABXYC’, L := 2, P := 3 );(* OUT = ‘ABC’ *) |
FIND | FIND |
Description | Find the character position of the beginning of the first occurrence of IN2 in IN1. If no occurrence of IN2 is found, then OUT := 0 |
Number of operands | 2 |
Input data type | STRING, STRING |
Output data type | UINT |
Examples | OUT := FIND( IN1 := ‘ABCBC’, IN2 := ‘BC’ ); (* OUT = 2 *) |
INSERT | INSERT |
Description | Insert IN2 into IN1 after the P-th character position |
Number of operands | 3 |
Input data type | STRING, STRING, UINT |
Output data type | STRING |
Examples | OUT := INSERT( IN1 := ‘ABC’, IN2 := ‘XY’, P := 2 );(* OUT = ‘ABXYC’ *) |
LEFT | LEFT |
Description | Leftmost L characters of IN |
Number of operands | 2 |
Input data type | STRING, UINT |
Output data type | STRING |
Examples | OUT := LEFT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘AST’ *) |
LEN | LEN |
Description | String length function |
Number of operands | 1 |
Input data type | STRING |
Output data type | UINT |
Examples | OUT := LEN( ‘ASTRING’ ); (* OUT = 7 *) |
MID | MID |
Description | L characters of IN, beginning at the P-th |
Number of operands | 3 |
Input data type | STRING, UINT, UINT |
Output data type | STRING |
Examples | OUT := MID( IN := ‘ASTR’, L := 2, P := 2 );(* OUT = ‘ST’ *) |
REPLACE | REPLACE |
Description | Replace L characters of IN1 by IN2, starting at the P-th character position |
Number of operands | 4 |
Input data type | STRING, STRING, UINT, UINT |
Output data type | STRING |
Examples | OUT := REPLACE( IN1 := ‘ABCDE’, IN2 := ‘X’, L := 2, P := 3 ); (* OUT = ‘ABXE’ *) |
RIGHT | RIGHT |
Description | Rightmost L characters of IN |
Number of operands | 2 |
Input data type | STRING, UINT |
Output data type | STRING |
Examples | OUT := RIGHT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘STR’ *) |
TO_STRINGFORMAT | TO_STRINGFORMAT |
Description | Conversion to STRING, with format specifier |
Number of operands | 2 |
Input data type | Any numerical type, STRING |
Output data type | STRING |
Examples | str := TO_STRINGFORMAT(10, ‘%04d’); (* str = ‘0010’*) |
TO_WSTRINGFORMAT | TO_WSTRINGFORMAT |
Description | Conversion to WSTRING, with format specifier |
Number of operands | 2 |
Input data type | Any numerical type, WSTRING |
Output data type | WSTRING |
Examples | wstr := TO_WSTRINGFORMAT(10, ‘%04d’); (* wstr = “0010” *) |
ADR | ADR |
Description | Return the address of a variable |
Number of operands | 1 |
Input data type | Any |
Output data type | DWORD |
Examples |
IMOVE | IMOVE |
Description | Valorize an interface using another interface and executing a query interface; checking if the class that implementthe source interface is also implementing the destination interface |
Number of operands | 1 |
Input data type | Interface instance |
Output data type | NULL if error, any if ok |
Examples |
JMP | JMP |
Description | Jump to a specific label |
Number of operands | 1 |
Input data type | STRING |
Output data type | |
Examples |
MOVE | MOVE |
Description | Assign a value to a variable, equivalent of LD and ST |
Number of operands | 2 |
Input data type | Any, Any |
Output data type | |
Examples |
REF | REF |
Description | Return the reference to a variable |
Number of operands | 1 |
Input data type | Any |
Output data type | Reference to the input variable |
Examples |
RET | RET |
Description | Return |
Number of operands | 0 |
Input data type | |
Output data type | |
Examples |
SIZEOF | SIZEOF |
Description | Return the size of a variable |
Number of operands | 1 |
Input data type | Any |
Output data type | UDINT |
Examples |
CONCAT_DATE | CONCAT_DATE |
Description | Create a valid DATE value given its single components (year, month and day). |
Number of operands | 3 |
Input data type | INT, INT, INT |
Output data type | DATE |
Examples | out := CONCAT_DATE(2020, 6, 17); (* out = 2020-06-17 *) |
CONCAT_DATE_LTOD | CONCAT_DATE_LTOD |
Description | Concatenate a DATE and a LTIME_OF_DAY into a LDATE_ AND_TIME |
Number of operands | 2 |
Input data type | DATE, LTIME_OF_DAY |
Output data type | LDATE_AND_TIME |
Examples | out := CONCAT_DATE_LTOD(2020-06-17,13:40:55.123456789); (* out = 2020-06-17-13:40:55.123456789 *) |
CONCAT_DATE_TOD | CONCAT_DATE_TOD |
Description | Concatenate a DATE and a TIME_OF_DAY into a DATE_AND_ TIME |
Number of operands | 2 |
Input data type | DATE, TIME_OF_DAY |
Output data type | DATE_AND_TIME |
Examples | out := CONCAT_DATE_TOD(2020-06-17, 13:40:55.123); (* out = 2020-06-17-13:40:55.123 *) |
CONCAT_DT | CONCAT_DT |
Description | Create a valid DATE_AND_TIME value given its single components (year, month, day, hours, minutes, seconds). |
Number of operands | 2 |
Input data type | INT, INT, INT, INT, INT, INT |
Output data type | DATE_AND_TIME |
Examples | out := CONCAT_DT(2020, 6, 17, 13, 40, 55); (* out =2020-06-17-13:40:55 *) |
CONCAT_LDATE | CONCAT_LDATE |
Description | Create a valid LDATE value given its single components (year, month and day). |
Number of operands | 3 |
Input data type | INT, INT, INT |
Output data type | LDATE |
Examples | out := CONCAT_LDATE(2020, 6, 17); (* out = 2020-06-17 *) |
CONCAT_LDT | CONCAT_LDT |
Description | Create a valid LDATE_AND_TIME value given its single components (year, month, day, hours, minutes, seconds, milliseconds, microseconds, nanoseconds). |
Number of operands | 9 |
Input data type | INT, INT, INT, INT, INT, INT, INT, INT, INT |
Output data type | LDATE_AND_TIME |
Examples | out := CONCAT_LDATE_AND_TIME(2020, 6, 17, 13, 40,55, 123, 456, 789);(* out = 2020-06-17-13:40:55.123456789 *) |
CONCAT_LTOD | CONCAT_LTOD |
Description | Create a valid LTIME_OF_DAY value given its single components (hours, minutes, seconds, milliseconds, microseconds and nanoseconds). |
Number of operands | 6 |
Input data type | INT, INT, INT, INT, INT, INT |
Output data type | LTIME_OF_DAY |
Examples | out := CONCAT_LTOD(13, 40, 55, 123, 456, 789); (* out = 13:40:55.123456789 *) |
CONCAT_TOD | CONCAT_TOD |
Description | Create a valid TIME_OF_DAY value given its single components (hours, minutes, seconds, milliseconds). |
Number of operands | 4 |
Input data type | INT, INT, INT, INT |
Output data type | TIME_OF_DAY |
Examples | out := CONCAT_TOD(13, 40, 55, 123); (* out =13:40:55.123 *) |
DAY_OF_WEEK | DAY_OF_WEEK |
Description | Get the day of week.It returns the day of the week represented in a range from 0 (Sunday) to 6 (Saturday). |
Number of operands | 1 |
Input data type | LDATE |
Output data type | SINT |
Examples | out := DAY_OF_WEEK(2020-06-17); (* out = 3 *) |
SPLIT_DATE | SPLIT_DATE |
Description | Split a LDATE into year, month and day integer pointer vabiables. The function returns TRUE in case of no errors. |
Number of operands | 4 |
Input data type | DATE/LDATE, @INT, @INT, @INT |
Output data type | BOOL |
Examples |
SPLIT_DT | SPLIT_DT |
Description | Split a DATE_AND_TIME into year, month, day, hours, minutes and seconds integer pointer vabiables. The function returns TRUE in case of no errors. |
Number of operands | 7 |
Input data type | DATE_AND_TIME, @INT, @INT, @INT, @INT, @INT, @INT |
Output data type | BOOL |
Examples |
SPLIT_LDT | SPLIT_LDT |
Description | Split a LDATE_AND_TIME into year, month, day, hours, minutes, seconds, milliseconds, microseconds and nanosecods integer pointer vabiables. The function returns TRUE in case of no errors. |
Number of operands | 10 |
Input data type | DATE_AND_TIME, @INT, @INT, @INT, @INT, @INT, @INT, @ INT, @INT, @INT |
Output data type | BOOL |
Examples |
SPLIT_LTOD | SPLIT_LTOD |
Description | Split a LTIME_OF_DAY into hours, minutes, seconds, milliseconds, microseconds and nanoseconds integer pointer vabiables. The function returns TRUE in case of no errors. |
Number of operands | 7 |
Input data type | LTIME_OF_DAY, @INT, @INT, @INT, @INT, @INT, @INT |
Output data type | BOOL |
Examples |
SPLIT_TOD | SPLIT_TOD |
Description | Split a TIME_OF_DAY into hours, minutes, seconds, milliseconds integer pointer vabiables. The function returns TRUE in case of no errors. |
Number of operands | 5 |
Input data type | TIME_OF_DAY, @INT, @INT, @INT, @INT |
Output data type | BOOL |
Examples |