Skip to main content

10.5.1. Arithmetic Function

10.5.1. Arithmetic Function

 

Returned value of arithmetic function is numeral.

Example: V1!=10, V2!=-1.23, V3!=3.14152, V20%=16, V21%=5, V7$="XDIST:20"

 

Function name

Explanation

Example

Returned value

ABS(a)

Absolute value of ‘a’ is returned.

ABS(V2!)

1.23

MAX(a, b)

Bigger value between ‘a’ and ‘b’ is returned.

MAX(V2!,-3)

-1.23

MIN(a, b)

Smaller value between ‘a’ and ‘b’ is returned.

MIN(V2!,-3)

-3

DEGRAD(a)

Radian value of ‘a’ is returned in a degree form.

DEGRAD(270)

4.712389

RADDEG(a)

Degree value of ‘a’ is returned in a radian form.

RADDEG(2*V3!)

359.997

SQR(a)

Square root of ‘a’ is returned.

SQR(V20%)

4

SIN(a)

Sine value of ‘a’ is returned in a radian form.

SIN(V3!/6)

0.5

COS(a)

Cosine value of ‘a’ is returned in a radian form.

COS(V3!/6)

0.866

TAN(a)

Tangent value of ‘a’ is returned in a radian form.

TAN(V3!/6)

0.577

ATN(a)

Arctangent value of ‘a’ is returned in a radian form.

ATN(0.5)

0.464

ATN2(a,b)

Arctangent value of a triangle whose ‘y’ length is ‘a’ and ‘x’ length is ‘b’ is returned in a radian form.

ATN(-2,0)

-1.571

DIST(a,b)

Distance to a point whose ‘x’ coordinate is ‘a’ and ‘y’ coordinate is ‘b’ is returned.

DIST(V21%,V21%)

7.071

ORD(a)

ASCII code of the first character in ‘a’ string is returned.

ORD("ERROR")

69

VAL(a)

Value expressed in ‘a’ string is returned.

VAL("29.38E-2")

0.2938

STRPOS(a,b)

First point where part of ‘a’ string corresponds to ‘b’ string is returned.

(First character point is 1.)

STRPOS(V7$,":")

6

LEN(a)

Length of ‘a’ string is returned.

LEN(V7$)

8

TIMER

Passed time from the power input time is returned in second(s).

TIMER

2796.37

ETR(a,b)

Return the radian value of the axis angle for the encoder value ‘b’ of the axis in the order ‘a’(1~).

ETR(2,&H400000)

1.571

RTE(a,b)

Return the encoder value ‘b’ for the axis angel radian value of the axis in the order ‘a’(1~).

RTE(2,1.3)

4120080