'***************************************************************************
'Galil Motion Control Sample DMC Code
'Filename: VariableChooseSub.dmc
'***************************************************************************
'Description:
'Jump to different subroutines based on the state of variable V1
'If V1 is not 0 or 1, neither subroutine will execute
'***************************************************************************
#main
v1= 0
#a
JS #b,v1=0;          'Jump to Sub #B if variable V1 is 0
JS #c,v1=1;          'Jump to Sub #C if variable V1 is 1
WT 250;                 'Wait 250msec
JP #a;                   'Jump back to label #A
#b
PR 10000;BG A;            'Move Relative 10000cts
AM A;                    'Wait for profiled motion to complete
EN;                     'Return from Subroutine
#c
PR -10000;BG A;           'Move Relative -10000cts
AM A;                    'Wait for profiled motion to complete
EN;                     'Return from Subroutine