Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:38:49 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  counting iterations of macro
Pages: 1   Go Down
Print
Author Topic: counting iterations of macro  (Read 2643 times)
0 Members and 1 Guest are viewing this topic.
rayscott
Active Member

Offline Offline

Posts: 6


View Profile
« on: June 16, 2008, 01: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
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #1 on: June 16, 2008, 01:31:11 PM »

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
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
vmax549
Guest
« Reply #2 on: June 25, 2008, 10:14:55 AM »

Ray I believe that mach has a built in loop counter that runs with subloop.

DRO# 222



Hope that helps, (;-) TP
« Last Edit: June 25, 2008, 10:20:11 AM by vmax549 » Logged
zephyr9900
Active Member

Offline Offline

Posts: 79



View Profile WWW
« Reply #3 on: January 09, 2010, 03:54:01 PM »

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


* reps_DRO.gif (18.76 KB, 522x587 - viewed 66 times.)
« Last Edit: January 09, 2010, 03:59:12 PM by zephyr9900 » Logged
Graham Waterworth
Administrator
*
Online Online

Posts: 1,665


West Yorkshire, England



View Profile WWW
« Reply #4 on: January 12, 2010, 07:00:34 AM »

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)
%
« Last Edit: January 12, 2010, 07:08:26 AM by Graham Waterworth » Logged

G-Code is on the cutting edge

Autovalues Engineering, CNC machining specialists, Bradford, England
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!