TSL Automation Solutions Logo

Section 15.4.8 · Chapter 15: Using Macros

Program Control

■ JMP

Format JMP P1
Function Unconditionally jumps to the program point specified by label P1.
P1 (CS) The label of the program point.
Example 1 IF $U10 == 0
JMP SKIP /* Skip the command "$U20 = $U10 / 2". */
ENDIF
$U20 = $U10 / 2
SKIP:
$U10 = 1

■ <label>

Format P1:
Function This is not an executable command. The P1 is the label of the program point where it is positioned.
P1 (CS) The character string as the label of the program point. Remember to have the character ':' after the label.
Example 1 IF $U10 == 0
JMP SKIP /* Skip the command "$U20 = $U10 / 2" */
ENDIF
$U20 = $U10 / 2
SKIP:
$U10 = 1

■ JMP ==

Format JMP(P1,P2 == P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is equal to P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP !=

Format JMP(P1,P2 != P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is not equal to P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP >

Format JMP(P1,P2 > P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is greater than P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP >=

Format JMP(P1,P2 >= P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is greater than or equal to P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP <

Format JMP(P1,P2 < P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is less than P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP <=

Format JMP(P1,P2 <= P3) Data Type U/S/UD/SD/F
Function Jumps to the program point specified by label P1 when P2 is less than or equal to P3.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP &

Format JMP(P1,P2 & P3) Data Type U/UD
Function Jumps to the program point specified by label P1 when the result of Bitwise AND between P2 and P3 is non-zero.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP !&

Format JMP(P1,!(P2 & P3)) Data Type U/UD
Function Jumps to the program point specified by label P1 when the result of Bitwise AND between P2 and P3 is zero.
P1 (CS) The label of the program point.
P2,P3 (I/E/C/AE) The operands.

■ JMP <bit>

Format JMP(P1,P2) Data Type B
Function Jumps to the program point specified by label P1 if the condition P2 is true (1/On).
P1 (CS) The label of the program point.
P2,P3 (I/E/CE) The operands.

■ JMP !<bit>

Format JMP(P1,!P2) Data Type B
Function Jumps to the program point specified by label P1 if the condition P2 is false (0/Off).
P1 (CS) The label of the program point.
P2,P3 (I/E/CE) The operands.

■ CALL

Format CALL P1
Function Goes to sub-macro P1.
P1 (Sub-macro name) The sub-macro to be called.
Example 1 CALL CommonFunction_01 /* Go to sub-macro named CommonFuncation_01 */

■ RET

Format RET
Function Returns to the calling macro. This command can only be used in sub-macros.

■ FOR

Format FOR P2 Data Type U
Function Runs the commands within the FOR loop by P2 times. A FOR loop is enclosed by a matching pair of FOR and NEXT commands. There can be up to 20 nested FOR loops.
P2 (I/C) Total times to run the FOR loop.
Note: If P2 is an internal variable, the value of P2 will be decreased by 1 after each loop. If the value of P2 is 1, the loop will be executed before exiting.
Example 1 FOR 10
$U100 = $U100 + 1 /* This command will be executed 10 times */
FOR 12
  $U200 = $U200 + 1 /* This command will be executed 120 times */
NEXT
NEXT
Example 2 $U1 = 10
FOR $U1
$U100 = $U100 + 1 /* This command will be executed 10 times */
$U2 = 12
FOR $U2
  $U200 = $U200 + 1 /* This command will be executed 120 times */
NEXT
NEXT

■ NEXT

Format NEXT
Function This command indicates the end of a FOR loop. It is not an executable command.
Example 1 $U1 = 10
$U2 = 12
FOR $U1
$U100 = $U100 + 1 /* This command will be executed 10 times. */
$U4 = $U2
FOR $U4
$U200 = $U200 + 1 /* This command will be executed 120 times. */
NEXT
NEXT
Example 2 $U1 = 10
$U2 = 12
FOR $U1
$U100 = $U100 + 1 /* This command will be executed 10 times. */
FOR $U2 /* The value of $U2 is decreased by 1 after each loop. If the value of $U2 is 1, run the loop and then exit the loop. */
$U200 = $U200 + 1 /* This command will be executed 21 times. */
NEXT
NEXT

■ STOP

Format STOP
Function Stops the macro immediately. If the macro is a Cycle macro, it will run again starting from the first command when the associated window is opened again. If the macro is a Main macro, it will run again starting from the first command when restarting the application.
This command cannot be used in sub-macros.

■ END

Format END
Function Indicates the end of macro and stops the macro in the current cycle. It can be put anywhere in a macro to stop the macro at any point. If the macro is a cyclic macro, such as the Main macro and the Cycle macro, it is stopped just in the current cycle and will be run again starting from the first command in the next cycle.
This command cannot be used in sub-macros.

■ QRET

Format QRET(P1) Data Type U
Function Report the result P1 of examining the qualification of the current record for the current query and stop the macro.
P1 (I) The result of qualification. Value 1 represents qualified. Value 0 represents unqualified.
Example QRET($U100) /* The current record is qualified in the query if $U100 is 1.*/

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