PROGRAMMING16. CUSTOM MACRO
B–63684EN/01
266
The operations listed in Table 16.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 16.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
Arcsine
Cosine
Arccosine
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, ASIN, ACOS, TAN, 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.
S The solution ranges from 180° to 0°.
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.
16.3
ARITHMETIC AND
LOGIC OPERATION
Explanations
D Angle units
D ARCSIN #i = ASIN[#j];
D ARCCOS #i = ACOS[#j];