beautypg.com

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

Page 425

background image

14

PM Designer Operation Manual

14-16

CHAPTER 14 USING MACROS

Logical OR ( || )

Format

P1

= P2 || P3

Data Type

B

Function

Saves 1 in P1 if either or 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)

14.4.5. Calculation

MAX

Format

P1

= MAX(P2,P3)

Data Type

U/S/UD/SD/F

Function

Sets P1 to the larger value of P2 and P3.

P1 (I/E)

The location to save the result.

P2,P3(I/E/C) The

operands.

Example 1

$U100

= MAX(

100

,

200

)

/* Set $U100 to 200 */

MIN

Format

P1

= MIN(P2,P3)

Data Type

U/S/UD/SD/F

Function

Sets P1 to the smaller value of P2 and P3.

P1 (I/E)

The location to save the result.

P2,P3(I/E/C) The

operands.

Example 1

$U100

= MIN(

100

,

200

)

/* Set $U100 to 100 */

BMAX

Format

P1

= BMAX(P2,P3)

Data Type

U/S/UD/SD/F

Function

Finds the maximum in an array starting from P2 with P3 elements and saves the result in P1.

P1 (I)

The location to save the result.

P2 (I)

The starting location of the array.

P3 (I/C)

The size of the array.

Example 1

$U100

= BMAX(

$U200

,

16

) (F)

/* Find the maximum among 16 floating point numbers starting

from $U200 and save the result in $U100 */

BMIN

Format

P1

= BMIN(P2,P3)

Data Type

U/S/UD/SD/F

Function

Finds the minimum in an array starting from P2 with P3 elements and saves the result in P1.

P1 (I)

The location to save the result.

P2 (I)

The starting location of the array.

P3 (I/C)

The size of the array.

Example 1

$U100

= BMIN(

$U200

,

60

) (F)

/* Find the minimum among 60 floating point numbers starting from

$U200 and save the result in $U100 */