TSL Automation Solutions Logo

Section 15.4.4 · Chapter 15: Using Macros

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) */

■ 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)

■ 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)

Need PM Designer itself?

V4 for current PK, PT, ITV and PM panels, V2 for older models. Free, sent by email.

Source.Section 15.4.4 of the PM Designer Software User Manual, Edition 2.0, © Cermate Technologies Inc. (www.cermate.com, service@cermate.com). Reproduced online, with the manual's own figures, by TSL Automation Solutions, authorised Cermate distributor, for users of Cermate HMI panels. PM Designer and PanelMaster are trademarks of Cermate Technologies Inc.

Text and figures are the manufacturer's and may describe features your panel or software version does not have. For a plain-language introduction read the PM Designer guide; for help with a specific panel contact TSL Automation.