Operators

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Operators

mapp Services V5.16

Operator

Explanation

ABS

Returns the absolute value of a number. ABS(-2) results in 2.

ACOS

Returns the arc cosine (inverse function of cosine) of a number.

adr

Returns the address of a variable.

ADRINST

Can only be called within a function block and returns the instance address of the current function block.

AND

Bitwise AND operator.

ASIN

Returns the arc sine (inverse function of sine) of a number.

ASR

Shifts an operand arithmetically to the right: A := ASR (IN, N);

IN is shifted to the right by N bits and filled with the sign bit from the left.

ATAN

Returns the arc tangent (inverse function of tangent) of a number.

COS

Returns the cosine of a number.

EXP

Exponential function: A := EXP (IN).

EXPT

Exponentiation of two operands: A := EXPT (IN1, IN2).

LIMIT

Limitation: A := LIMIT (MIN, IN, MAX);

MIN is the lower limit of the result and MAX is the upper limit. If IN is less than MIN, MIN is returned as the result; if IN is greater than MAX, MAX is returned as the result; otherwise, IN is returned as the result.

LN

Returns the natural logarithm of a number.

LOG

Returns the 10-base logarithm of a number.

MAX

Returns the highest value as the result.

MIN

Returns the lowest value as result.

MOD

Modulo division of a variable of type USINT, SINT, INT, UINT, UDINT or DINT by another variable of one of these types.

MOVE

Copies the content of the input variable to the output variable. The assignment operator represented by the double symbol := must be used.

"A := B;" is the same as "A := MOVE (B);".

MUX

Selection: A := MUX (SELECT, IN1, IN2, ... INX);

SELECT specifies which of the operators (IN1, IN2, ... INX) is supplied as the result.

NOT

Bitwise negation of a bit operand.

OR

Bitwise OR operator.

ROL

Bitwise left rotation of an operand: A := ROL (IN, N);

IN is shifted N times to the left by one bit position; the outermost left bit is inserted again from the right.

ROR

Bitwise right rotation of an operand: A := ROR (IN, N);

IN is shifted N times to the right by one bit position; the outermost right bit is inserted again from the left.

SEL

Binary selection: A := SEL (SELECT, IN1, IN2)

SELECT must be of type BOOL. If SELECT has the value FALSE, IN1 is returned as the result; otherwise, IN2.

SHL

Bitwise left shift of an operand: A := SHL (IN, N);

IN is shifted to the left by N bits and filled with zeros from the right.

SHR

Bitwise right shift of an operand: A := SHR (IN, N);

IN is shifted to the right by N bits.

If IN has a signed data type, the sign bit is used to fill in from the left.

If IN has an unsigned data type, zeros are filled in from the left.

SIN

Returns the sine of a number.

sizeof

If a variable is specified as an operand, SIZEOF returns the number of bytes required by the specified variable.

If a type name is specified as the operand, SIZEOF returns the number of bytes required by the specified type.

SQRT

Returns the square root of a number.

TAN

Returns the tangent of a number.

TRUNC

Returns the integer part of a number.

XOR

Bitwise EXCLUSIVE OR operator.

Table: Operators

Topics in this section:

Priority of operators