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

4
14
PM Designer Operation Manual
14-13
CHAPTER 14 USING MACROS
SETM
Format
P1
= SETM(P2,P3)
Data Type
U
Function
Sets P3 words of P1 to
word value P2.
P1 (I/E)
The starting location of the memory to be set.
P2 (I/C)
The set value or the location that holds the set value.
P3 (I/C)
The number of words to be set.
Example 1
$U100
= SETM(0,
16
)
/* Set the 16 words starting from $U100 to 0. */
Example 2
W60
= SETM(
$U200
,
$U2
)
/* Set the words of the word array starting from W60 with the size
specified in $U2 to the value of $U200.*/
14.4.3. Arithmetic Operation
Addition ( + )
Format
P1
= P2 + P3
Data Type
U/S/UD/SD/F
Function
Adds P2 and P3 and saves the result 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
=
0.3
*
$U0
+
0.1
*
$U2
+
0.6
*
$U4
(F)
Subtraction ( - )
Format
P1
= P2 - P3
Data Type
U/S/UD/SD/F
Function
Subtracts P3 from P2 and saves the result 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
=
0.3
*
$U0
-
10.75
(F)
Multiplication ( * )
Format
P1
= P2 * P3
Data Type
U/S/UD/SD/F
Function
Multiplies P2 by P3 and saves the product in P1.
P1 (I/E)
The location to save the product. If the product is overflow, the higher bits exceeding the limit will
be truncated and the remaining bits will be stored in P1.
P2,P3 (I/E/C/AE) The
operands.
Example 1
$U100
=
$U102
*
0x192
Example 2
W100
= (
$U0
+
$U2
) * (
$U4
+
$U6
) (F)