WWW.NNC.IR
Macro Reference
799
8
Appendices
Vision System FH/FZ5 Series
User’s Manual (Z340)
Example
Uses the variables used in subroutines as local variables.
*EXPA
Rem Display the current value of the variable.
Print A&, B&, C&, D#, E#
Rem Use the EXPA subroutine to save the current values of the variables in order to prepare for treating the variable
as local variables.
VarPush A&, B&, C&, D#, E#
Rem Use A&, B&, C&, D#, and E# freely.
GetUnitData 2, "CR", A&
GetUnitData 3, "CR", B&
GetUnitData 4, "CR", C&
GetUnitData 5, "X", D#
GetUnitData 6, "Y", E#
Rem Check the current values of the variables before calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Variables named A&, B&, C& are used in the *EXPB subroutine.
Rem These names are also used for variables in this *EXPA subroutine.
Rem Although being nested with the Gosub statement in this program example,
Rem saving and restoration of variable values are performed with the Varpush and Varpop functions within the *EXPB
subroutine,
Rem so as to prevent variable values from being unintentionally overwritten.
Gosub *EXPB
Rem Check the current value of the variables after calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Restore the current value of the variables that were saved at the beginning of the subroutine EXPA.
VarPop
Return
*EXPB