I just need to know the correct format to enter.
I just need to know the correct format to enter.
Here's the logic I use, take it for what its worth. Its been so long since I wrote it, I forget how to interpret it
ISTHERE L;\198;\199
IF\198<1THEN LABEL2 STARTING LINE FOR SUBROUTINE NOT COMMANDED! :[CYCLEBUTT] :EXIT
ISTHERE R;\198;\199
IF\198=<1THENr=1 :LABEL2 NUMBER OF REPEATS "R" HAS DEFAULTED TO ONLY 1;14'defaults to one time through the subroutine
\36=\199 ISPLAY6 \36
GOSUB Ol;r 'subroutine must be lettered with an "O" firstly, lower case "L" is "O"subroutine number, repeated for "R" number of times
-----M98
LOADING \55
IF\55<1THENEXIT
REFRESH
'next code for incrementing the part counter as a repeat counter for subroutines
\36={\36-1}
DISPLAY6 \36
RETURN
-----M99
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Well I gotta say that's way over my head.
I was hoping like a fanuc ar a fagor where you can have a subroutine inside a normal program, I think I'm a bit set in my ways with subroutines.
On our Fagor lathe you enter G22 N06.4 (G22 call the subroutine No. 06 and repeats it 4 times) and a bit lower in the program have G20 (start of sub routine) and at the bottom G24 (end of subroutine).
*
N0001 G90 G80 G40
N0005 M6T1
N0010 G43 H1 Z1.0
N0015 S500 M3
N0020 G00 X0 Y0
N0030 M98 P1010 L10
N0130 G93 M30
N1010 G01 Z-0.5 F25
N1020 X2
N1030 Y2
N1040 X0
N1050 Y0
N1060 G0 Z1
N1070 X3
N1080 G92 X0 Y0
N1160 M99
Mill example.
Hey,
This is the simplified version. There are other options you can research later on.
1. Start by entering the "M98" command, followed by "P" and a label number and then "L" and the number of loops you want to repeat.
ie: M98 P1234 L5
This says that you want to run Program 1234, 5 times
2. On the subroutine, start by entering "O" followed by the label number
ie: O1234
3. When you're done with the subroutine, return to the main program by entering "M99"
4. Tell the main program to stop at the end so it doesn't run the subroutine again.
ie: M2 or M30
Here's how it all looks together
.....
.....regular program
.....
M98 P1234 L5 (go to sub labeled 1234 and loop 5 times)
.....
.....more regular program
.....
M30 (end of main program, don't execute beyond here)
O1234 (start of sub)
....
.... do something
....
M99 (return)
L8er,
Julio
In CAmsoft, you can set the function up to emulate any controller synatax you like. But, you have to have some logic in M98 and M99 or calling them won't do anything.
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
I do my loops using M98 like you showed.
One thing I would love to do, but havne't figured out, is how to call a subroutine from WITHIN a subroutine. It just doesn't work on CutViewer anyway. Not sure if it works on Mach2 or not.
Is this disallowed?
Swami
Hello people,
Some new faces we see.
We believe we could help on this one and set a precedent to show you how to help yourself, regarding this topic as well as others.
Perhaps the best two pieces of advice to handle any topic are:
(1) In almost every question posed here in CNCZONE the answer is that you can have it any way you want. There is no single way to handle subroutines or almost any question posed for any topic about CamSoft, at least the CNC Professional version. Every one posting their methods for M98,M99 are correct. Simply because it depends on how the system logic is set up by the installer in the G&M code tables. For example, an installer may just not want to bother and use the default industry standard G&M code set, which includes M98,M99 logic already or they can opt to rearrange things to meet their customers needs by customizing the logic for any G and M code. Some customers want backwards compatibility to older formats. Sometimes we think we have seen everything and can't be surprised, but a make or break request comes in time to time that makes us and our dealers thankful for the flexibility of CNC Professional.
(2) To get the fastest answers use the Search for Solutions button on CNCSETUP. Here you can search for answer like a web-browser, through 130+ megabytes of electronic text, photos and charts even movies. A search on M98 pops up 21 occurrences of page documentation for this topic.
Some information you'll find is:
The logic in M98 can be set up for the letters O, P or N or any letter to call the subroutine. Also the number of loops are usually denoted as L but can be P in some cases. There are even pure jumps to other line numbers instead of subroutines that return.
QUESTION 169
Can we call a Macro from within another Macro?
QUESTION 209
How do we call and loop subroutines in the G code program?
Below are some examples:
(Call a simple subroutine and repeat the subroutine 3 times.)
N1 G0 X0 Y0 Z0
N2 M98 P1234 L3
N3 M30
O1234
N4 G1 Z-.5 F25
N5 G0 Z.1
N6 M99
(Use a subroutine to loop the entire program 100 times.)
N1 M98 P1234 L100
N2 M30
O1234
N4 G0 X0 Y0 Z0
N5 G1 Z-.5 F25
N6 G0 Z.1
N7 M99
(Nested Subroutines)
N1 G0 X0 Y0 Z0
N2 M98 P1234 L1
N3 M30
O1234
N4 G0 X1 Y1 Z1
N5 M98 P5678 L1
N6 M99
O5678
N7 G1 Z-.5 F25
N8 G0 Z.1
N9 M99
Tech Support
CamSoft Corp.
(951) 674-8100
[email protected]
www.cnccontrols.com
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Got a couple more question for you guys (surprise surprise).
What's the difference between a stepper motor and an active low pulse stepper motor? (how do I tell which I have?)
Also after I home the machine then move the axes to where I want the home light stays on, what's the best way to ensure when I move from machine 0;0;0;0;0;0 the light will go out?
I haven't seen your logic of course, but you'll simply have to write logic to turn the light off when the sequence is completed. I'm assuming you are talking about a Camsoft gui "light".
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Active high or low stepper is drive dependant (high=motor winding on or low=motor winding on.).
If your home is actually on the switch you can put the logic in the LIMITS.FIL.
Anytime a limit or home switch is triggered the LIMITS.FIL is ran.
If your home is not on the switch you can use ISTHERE logic in the commands G00, G01, JOG.FIL, ect...
Darek
Thanks this helped me alot with my MillMaster Pro program!
-truline