4 operation instructions – Yaskawa YASNAC PC NC Programming Manual User Manual

Page 292

Advertising
background image

4 - 155

YASNAC PCNC Programming Manual

Chapter 4: Enhanced Level Commands

If an undefined variable is used in a conditional expression, it is treated to have the
variable value of “0” with an exception of EQ and NE.

4.4.4

Operation Instructions

By performing general arithmetic operations in which local variables, common variables, system
variables, and constants are connected with operators and functions, it is possible to set the result
of operation to the given variable.

The variables used in the arithmetic operation read the required data from the internal variable
data area. The result of the operation is set to a variable to write the result of the operation to the
internal variable data area. The write cycle is completed when the execution of one block is com-
pleted.

The basic formula of arithmetic operation is “#i = <expression>”. The following operations and
functions can be used.

(1) Definition and Setting of Variables

(2) Addition Type Operations

(3) Multiplication Type Operation

#3 = 0, #2 = <empty>

#3EQ #2: Not satisfied

#3 = 0, #2 = <empty>

#3NE #2: Satisfied

#3 = 0, #2 = <empty>

#3GE #2: Satisfied

#3 = 0, #2 = <empty>

#3LT #2: Not satisfied.

#i = ##j

Definition or setting

#i = # [#j = #k]

Indirect designation

#i = #j + #k

Sum

#i = #j - #k

Difference

#i = #j OR #k

Logical sum (for each bit in 32-bit binary)

#i = #j XOR #k

Exclusive logical sum (for each bit in 32-bit binary)

#i = #j*#k

Product

#i = #j/#k

Quotient

#i = #j AND #k

Logical product (for each bit in 32-bit binary

#i = #j MOD #k

Remainder
(With #j and #k, remainder is obtained after rounding the
values to an integer. If #j is negative, #i is also negative.)

Advertising