TSL Automation Solutions Logo

Section 15.4.7 · Chapter 15: Using Macros

Conditional Operation

■ IF ==

Format IF P2 == P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ IF !=

Format IF P2 != P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is not equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ IF >

Format IF P2 > P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is greater than P3.
P2,P3 (I/E/C/AE) The operands.

■ IF >=

Format IF P2 >= P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is greater than or equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ IF <

Format IF P2 < P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is less than P3.
P2,P3 (I/E/C/AE) The operands.

■ IF <=

Format IF P2 <= P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this IF command when P2 is less than or equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ IF &

Format IF P2 & P3 Data Type U/UD
Function Executes the commands in the command block following this IF command when the result of Bitwise AND between P2 and P3 is non-zero.
P2,P3 (I/E/C/AE) The operands.

■ IF !&

Format IF !(P2 & P3) Data Type U/UD
Function Executes the commands in the command block following this IF command when the result of Bitwise AND between P2 and P3 is zero.
P2,P3 (I/E/C/AE) The operands.

■ IF <bit>

Format IF P2 Data Type B
Function Executes the commands in the command block following this IF command if the condition P2 is true (1/On).
P2 (I/E/CE) The condition.

■ IF !<bit>

Format IF !P2 Data Type B
Function Executes the commands in the command block following this IF command if the condition P2 is false (0/Off).
P2 (I/E/CE) The condition.

■ ELIF ==

Format ELIF P2 == P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF !=

Format ELIF P2 != P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is not equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF >

Format ELIF P2 > P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is greater than P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF >=

Format ELIF P2 >= P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is greater than or equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF <

Format ELIF P2 < P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is less than P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF <=

Format ELIF P2 <= P3 Data Type U/S/UD/SD/F
Function Executes the commands in the command block following this ELIF command when P2 is less than or equal to P3.
P2,P3 (I/E/C/AE) The operands.

■ ELIF &

Format ELIF P2 & P3 Data Type U/UD
Function Executes the commands in the command block following this ELIF command when the result of Bitwise AND between P2 and P3 is non-zero.
P2,P3 (I/E/C/AE) The operands.

■ ELIF !&

Format ELIF !(P2 & P3) Data Type U/UD
Function Executes the commands in the command block following this ELIF command when the result of Bitwise AND between P2 and P3 is zero.
P2,P3 (I/E/C/AE) The operands.

■ ELIF <bit>

Format ELIF P2 Data Type B
Function Executes the commands in the command block following this ELIF command if the condition P2 is true (1/On).
P2 (I/E/CE) The condition.

■ ELIF !<bit>

Format ELIF !P2 Data Type B
Function Executes the commands in the command block following this ELIF command if the condition P2 is false (0/Off).
P2 (I/E/CE) The condition.

■ ELSE

Format ELSE
Function This command specifies the beginning of the default command block that will be executed if none of the conditions in the preceding IF and/or ELIF commands is true. This is not an executable command.
Example IF-Command Structures:
Commands and Structures Description
IF <condition>
…
ENDIF
Runs the command block between IF and ENDIF when the condition is true, otherwise ignores the command block.
IF <condition>
…
ELSE
…
ENDIF
Runs the command block between IF and ELSE when the condition is true, otherwise runs the command block between ELSE and ENDIF.
IF <condition>
…
ELIF <condition_2>
…
ELIF <condition_3>
.
.
.
ELIF <condition_N>
…
ENDIF
Runs the command block between IF and the first ELIF and ignores all the following commands in the structure when condition 1 is true, otherwise examines condition 2. Runs the command block between the first ELIF and the second ELIF and ignores all the following commands in the structure when condition 2 is true, otherwise checks condition 3. Repeats the same operation until condition N is processed. If none of the conditions are true, no command block in this structure is run.
IF <condition>
…
ELIF <condition_2>
…
ELIF <condition_3>
.
.
ELIF <condition_N>
…
ELSE
…
ENDIF
Runs the command block between IF and the first ELIF and ignores all the following commands in the structure when condition 1 is true, otherwise examines condition 2. Runs the command block between the first ELIF and the second ELIF and ignores all the following commands in the structure when condition 2 is true, otherwise checks condition 3. Repeats the same operation until condition N is processed. Runs the command block between ELSE and ENDIF if none of the conditions are true.
Note that there can be up to 20 nested IF-command structures.

■ ENDIF

Format ENDIF
Function This command specifies the end of a command block, which begins at the command following the matching IF, ELIF, or ELSE command. This is not an executable command.
Example IF-Command Structures:
Commands and Structures Description
IF <condition>
…
ENDIF
Runs the command block between IF and ENDIF when the condition is true, otherwise ignores the command block.
IF <condition>
…
ELSE
…
ENDIF
Runs the command block between IF and ELSE when the condition is true, otherwise runs the command block between ELSE and ENDIF.
IF <condition>
…
ELIF <condition_2>
…
ELIF <condition_3>
.
.
.
ELIF <condition_N>
…
ENDIF
Runs the command block between IF and the first ELIF and ignores all the following commands in the structure when condition 1 is true, otherwise examines condition 2. Runs the command block between the first ELIF and the second ELIF and ignores all the following commands in the structure when condition 2 is true, otherwise checks condition 3. Repeats the same operation until condition N is processed. If none of the conditions are true, no command block in this structure is run.
IF <condition>
…
ELIF <condition_2>
…
ELIF <condition_3>
.
.
ELIF <condition_N>
…
ELSE
…
ENDIF
Runs the command block between IF and the first ELIF and ignores all the following commands in the structure when condition 1 is true, otherwise examines condition 2. Runs the command block between the first ELIF and the second ELIF and ignores all the following commands in the structure when condition 2 is true, otherwise checks condition 3. Repeats the same operation until condition N is processed. Runs the command block between ELSE and ENDIF if none of the conditions are true.
Note that there can be up to 20 nested IF-command structures.

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.7 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.