Pm designer operation manual, Logical operation – B&B Electronics WOP-2121V-N4AE - Manual User Manual
Page 423

14
PM Designer Operation Manual
14-14
CHAPTER 14 USING MACROS
Division ( / )
Format
P1
= P2 / P3
Data Type
U/S/UD/SD/F
Function
Divides P2 by P3 and saves the quotient in P1.
P1 (I/E)
The location to save the result.
P2,P3 (I/E/C/AE) The
operands.
Example 1
$U100
=
$U101
/
$U102
(U)
Example 2
W100
= (
$U0
+
$U2
) / (
$U4
+
$U6
) (F)
Modulus ( % )
Format
P1
= P2 % P3
Data Type
U/S/UD/SD
Function
Divides P2 by P3 and saves the remainder in P1.
P1 (I/E)
The location to save the result.
P2,P3 (I/E/C/AE) The
operands.
Example 1
$U100
=
$U30
%
16
(U)
Example 2
W100
=
$U200
% (
$U402
+
$U106
) (SD)
14.4.4. Logical Operation
Bitwise Inclusive OR ( | )
Format
P1
= P2 | P3
Data Type
U/UD/B
Function
Performs bitwise Inclusive OR operation of P2 and P3 and saves the results in P1.
P1 (I/E)
The location to save the result.
P2,P3 (I/E/C) The
operands
Example 1
W60 =
1111000000001111b
$U100
=
0000111100001111b
|
W60
(U)
/* The value of $U100 is 1111111100001111b */
Example 2
B15
=
$U1.2
|
B14
(B)
/* If either $U1.2 or B14 has a value of 1(On), B15 has the value 1(On).
Otherwise, B15 has the value 0(Off)*/
Bitwise AND ( & )
Format
P1
= P2 & P3
Data Type
U/UD/B
Function
Performs bitwise AND operation of P2 and P3 and saves the results in P1.
P1 (I/E)
The location to save the result.
P2,P3 (I/E/C) The
operands
Example 1
W60 =
1111000000001111b
$U100
=
0000111100001111b
&
W60
(U)
/* The value of $U100 is 0000000000001111b */
Example 2
B15
=
$U1.2
&
B14
(B)
/* If both $U1.2 and B14 are 1(On), B15 is set to 1(On). Otherwise B15 is
set to 0(Off) */