Section 1 Outline of Macro Function
NS series Macro Referenc
Basic Operational Statements
The following operational statements can be used in the program.
Item Operator Example meaning
substitution = A = B Substitute B for A
addition + C = A+B Set A+B to C
subtraction - C = A–B Set A–B to C
multiplication * C = A*B Set AxB to C
division / C = A/B Set A/B to C
residue % C = A%B Set A%B to C
OR | C = A|B Logically ORs for A and B
AND & C = A & B Logically ANDs for A and B
NOT ! C = !A Set C for denial of A
Exclusive ˆ C = A^B Result C of logical XORs for A and B
Complement of 1 ~ B = ~A Set the 1-complement of A to B
Bit Shift (left) << C = A<<B Set the value that A is ltic shifted B-
bit to the left to C.
Bit Shift (right) >> C = A>>B Se the value that A is arithmetic
shifted B-bit to the right to C.
Reference
If executing logical operation, process must be performed between the same data types
(between word, bit, or long access)
E.g.$SW0L=$SW10L&$W20L;’Use all long access of word’
Multiple operations can be combined.
E.g. A=(B+C)*(D+E/2)
The priority of orders is as follows.
Item Symbol
High ( )
~
*, /,%
+, -
<< ,>>
&
ˆ
|
Low =
1-12