PROGRAMMING15. CUSTOM MACRO
B–63004EN/02
292
The operations listed in Table 15.3 (a) can be performed on variables. The
expression to the right of the operator can contain constants and/or
variables combined by a function or operator. Variables #j and #K in an
expression can be replaced with a constant. Variables on the left can also
be replaced with an expression.
Table 15.3 (a) Arithmetic and logic operation
Function Format Remarks
Definition #i=#j
Sum
Difference
Product
Quotient
#i=#j+#k;
#i=#j–#k;
#i=#j*#k;
#i=#j/#k;
Sine
Arc sine
Cosine
Arc cosine
Tangent
Arctangent
#i=SIN[#j];
#i=ASIN[#j];
#i=COS[#j];
#i=ACOS[#j];
#i=TAN[#j];
#i=ATAN[#j]/[#k];
An angle is specified in de-
grees. 90 degrees and 30
minutes is represented as
90.5 degrees.
Square root
Absolute value
Rounding off
Rounding down
Rounding up
Natural logarithm
Exponential function
#i=SQRT[#j];
#i=ABS[#j];
#i=ROUND[#j];
#i=FIX[#j];
#i=FUP[#j];
#i=LN[#j]
#i=EXP[#j];
OR
XOR
AND
#i=#j OR #k;
#i=#j XOR #k;
#i=#j AND #k;
A logical operation is per-
formed on binary numbers
bit by bit.
Conversion from BCD to BIN
Conversion from BIN to BCD
#i=BIN[#j];
#i=BCD[#j];
Used for signal exchange
to and from the PMC
The units of angles used with the SIN, COS, TAN, ASIN, ACOS and
ATAN functions are degrees. For example, 90 degrees and 30 minutes is
represented as 90.5 degrees.
S The solution ranges are as indicated below:
When the NAT bit (bit 0 of parameter 6004) is set to 0: 270° to 90°
When the NAT bit (bit 0 of parameter 6004) is set to 1: –90° to 90°
S When #j is beyond the range of –1 to 1, P/S alarm No. 111 is issued.
S A constant can be used instead of the #j variable.
15.3
ARITHMETIC AND
LOGIC OPERATION
Explanations
D Angle units
D ARCSIN #i = ASIN[#j];