Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: rayscott on June 16, 2008, 02:22:36 PM
-
Hello all,
I am running programs that need to load a part, do movements, other stuff, move...etc... unload part, .. restart. For now, the operator watches the machine run for several hours as it loads and unloads from a magazine. I don't have a "part in magazine" detector and just want to tell the program to run 16 cycles. I am pretty good at writing macros.. How would I recall values of variables to count through 16 cycles?
Thank You,
Ray Scott
-
you can run a "G code sub routine", or if you want you can use "Vars" to hold your counts.
SetVar(100, 16) will set the # 16 in the VAR 100,
GetVar(100) will get the value in VAR 100
scott
-
Ray I believe that mach has a built in loop counter that runs with subloop.
DRO# 222
Hope that helps, (;-) TP
-
I realize that this is a very old thread, but it's the only information I've been able to find.
vmax549, thank you for the tip.
I've tried both OEM DRO 222 (Sub Program depth) and 78 (Repetitions DRO) without success.
My test program is
G18 (X-Z plane)
G20 (inch units)
G90 (absolute coordinates)
M98 P01 L6 (perform subroutine 01 6 times)
M30 (end program)
O01 (the subroutine)
G00 Z0.2500
G00 Z0.0000
M99 (return)
M30 (redundant end of program for safety)
I'm testing the DRO on my lathe, thus the G18. The DRO just stays at 0 and doesn't increment.
I just created a DRO on my run screen and assigned it OEM 222 (or 78). Is there something else I need to do or that I'm not doing right?
Randy
-
If you set your DRO to 222 and run this program the DRO counts down to zero, you have to use a small delay to give mach time to update the DRO's.
Graham
%
G18 (X-Z plane)
G20 (inch units)
G90 (absolute coordinates)
M98 P01 L6 (perform subroutine 01 6 times)
M30 (end program)
O01 (the subroutine)
G00 Z0.2500
G00 Z0.0000
G4 P100
M99 (return)
%