There are several ways to do it. One is too call the sub from inside the Gcode program . The other way is to call it from the macro directory
G98 P1 L1 Calls the sub from inside the program.
o1 This would be the sub code included at the end of the program
M8 M9
G4 P0.25
M99
%
M98 (Name of sub.tap) would call the sub from the macro directory
'Name of sub.tap This would be the sub program stored in the macro directory under the name of "Name of Sub.tap"
M8 M9
G4 P0.25
M99
%
Hope that helps, (;-)