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

14
PM Designer Operation Manual
14-12
CHAPTER 14 USING MACROS
14.4.2. Data Transfer
Assignment ( = )
Format
P1
= P2
Data Type
U/S/UD/SD/F/B
Function
Assigns the value of P2 to P1.
P1 (I/E)
The destination.
P2 (I/E/C/AE)
The source.
Example 1
$U2
=
123.45
(F)
/* Assign 123.45 to $U2 (and $U3) */
Example 2
$U100.f
=
1
(B)
/* Turn on the specified bit */
Example 3
W60
= (
$U30
+
$W50
-
1000
) /
2
(SD)
/* Write the result of the arithmetic expression to W60. */
Example 4
V0.0
=
2\M0
(B)
/* Assign the bit value of M0 of link 2 to the bit V0.0 of link 1*/
Logical NOT ( = ! )
Format
P1
= ! P2
Data Type
B
Function
Reverses P2 and saves the result in P1.
P1 (I/E)
The location to save the result.
P2 (I/E)
The operand.
Example 1
$U2.3
= !
$U3.4
(B)
/* If $U3.4 is 1 (On), $U2.3 is 0 (Off) */
" "
Format
P1
= "P2"
Function
Copies the quoted ASCII character string P2 to P1. Note that the string is a null terminated string.
If the length of the string is N then N+1 bytes will be copied to P1 and the last byte is 0.
P1 (I)
The location to save the result.
P2 (A)
The quoted ASCII character string.
Example 1
$U60
=
"TEST"
/* The null character (00h) will be moved to the low byte of $U62 */
Example 2
$U20
=
"ABCDE"
/* The null character (00h) will be moved to the high byte of $U22 */
MOV
Format
P1
= MOV(P2,P3)
Data Type
U
Function
Copies P3 words of P2 to P1.
P1 (I/E)
The starting location of the memory to receive the copy.
P2 (I/E)
The starting location of the memory to be copied.
P3 (I/C)
The number of words to be copied.
Example 1
$U100
= MOV(
$U200
,
16
)
/* Copy the 16 words starting from $U200 to $U100 */
Example 2
W60
= MOV(
$U200
,
$U2
)
/* Copy the word array starting from $U200 with the size specified in
$U2 to W60.*/
Example 3
$U10
= MOV
(
2\D100
,
10
)
/* Copy D100 ~ D109 of link 2 to $U10 ~ $U19.*/