beautypg.com

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

Page 424

background image

4

14

PM Designer Operation Manual

14-15

CHAPTER 14 USING MACROS

Bitwise Exclusive OR ( ^ )

Format

P1

= P2 ^ P3

Data Type

U/UD/B

Function

Performs bitwise Exclusive 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 1111111100000000b.*/

Example 2

B15

=

$U1.2

^

B14

(B)

/*If both $U1.2 and B14 are 1(On) or 0(Off), the B15 is set to 0(Off).

Otherwise B15 is set to 1(On)*/

Left Shift ( << )

Format

P1

= P2 << P3

Data Type

U/UD

Function Shifts

P2 to the left by P3 bits and saves the results in P1. The operation supports the logic shift

only.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The value or the location that holds the value to be shifted.

P3 (I/E/C)

The number of bits to be shifted.

Example 1

$U100

=

$U101

<<

8

(U)

Example 2

W200

=

W100

<<

$U10

(UD)

Right Shift ( >> )

Format

P1

= P2 >> P3

Data Type

U/UD

Function Shifts

P2 to the right by P3 bits and saves the results in P1. The operation supports the logic shift

only.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The value or the location that holds the value to be shifted.

P3 (I/E/C)

The number of bits to be shifted.

Example 1

$U100

=

$U101

>>

8

(U)

Example 2

W200

=

W100

>>

$U10

(UD)

Logical AND ( && )

Format

P1

= P2 && P3

Data Type

B

Function

Saves 1 in P1 if both P2 and P3 are 1, otherwise saves 0 in P1.

P1 (I/E)

The bit to save the result.

P2,P3(I/E/C) The

operands.

Example 1

$U100.0

=

$U101.0

&&

$U101.1

(B)