![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Haas Mills Discuss Haas machinery here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| ||||
| ||||
I wrote a program that has a couple of sub program calls in it. I loaded the programs, set up offsets & went to the graph function to run the program. It runs through the first moves but when it comes to the subs it just skips over them like they aren't there. Basically I'm just trying to learn how to write sub programs and this part we make is ideal. Code monkey's long hand version not elegant to paraphrase. I ran the program in air for a few minutes and everything is ok up to the point I ran it, after the first call first repeat, but without graphing it I have to watch it cut for a long time to proof it and I'm worried about the g91 X-1.875 move and the call in that sub for another sub with repeats. I've got the sub programs loaded into the controller @ o9001 and o9002. The code is below if that helps. % O0050 (CTRC HAMMER OP01) (T01 - D1.5IN SINGLE PT CCW ROT) (MAT-S7 TOOL STEEL ANNEALED) N0010 G20 G40 G49 G90 N0020 M6 T01 N0030 G43 H01 N0040 G0 G54 X-3.125 Y-3.25 N0050 S670 M04 N0060 Z.25 M08 N0070 M98 P9001 K15 N0080 M98 P9002 K11 N0090 M09 N0100 M05 N0110 G91 G28 Z0.0 N0120 M30 % % O9001 (CTRC HAMMER SUB1) N0140 G91 G1 Y.05 F10.0 N0150 Z-2.75 F2.7 N0160 Y-.05 F10.0 N0170 G0 Z2.75 N0180 G1 Y.05 F10. N0190 M99 % % O9002 (CTRC HAMMER SUB2) N0210 G91 X-1.875 Y-.75 N0220 M98 P9001 K15 N0230 M99 %
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain |
|
#2
| ||||
| ||||
| You can run the program in single step, even in graphics mode. Press F4 to see the code at the bottom of the graphics window. You should be able to see what line is executing, so that you can check your program jumps. I'm not sure about calling repeats with a "K" address? Shouldn't that be "L"? If I am intending to switch to incremental mode, I always make a point of writing G91 on a line by itself. When I switch back, I write G90 on a line by itself, before the M99. If you intend to begin your subprogram in incremental, it is usually best to start with a G91 and end with a G90 before it jumps back to the main program, providing that the main program is all absolute. You can then call G91 in the next subprogram and end that one with a G90.
__________________ 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) |
|
#3
| |||
| |||
| Change your subprogram number to something different than 9nnnn. Haas uses 9nnnn for some of the options such as engraving and there are settings which turn off the Graphics display for 9nnnn programs. You can go into the Settings and turn them on if you really want to keep the 9nnnn numbering. EDIT: Noticed Hu's comment about K and L...he is correct, L is the one for multiple sub calls.
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
|
#4
| ||||
| ||||
| Hu, I was using the F4 and F1 which is how I saw it seeming to skip over. I'll change that K with an L tomoorow and check that. I should have checked that in the fine manual. Might have been the lathe in school that used the K address. I'll remember that about the absolute and incremental. Harder to make a mistake that way. Geof, Why would you not want to use the 9nnn numbers? I could use another series like the 7nnn but aren't the 9nnn the only ones that can be locked? I had planned to log the sub-programs and load them on both machines but wanted to be able to lock those programs from editing in the future.
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain |
|
#5
| |||
| |||
I also have an aversion to using the same number group as the canned programs just in case I screw up and overwrite something.
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
| Sponsored Links |
|
#6
| ||||
| ||||
Hu's and your pointer on the address value fixed the problem, looking at the machine position it was returning to Y-3.25 after returning to g54 Z.25 after the last repeat so it seems to be moving like I want. Now I just need to rewrite with the seperate g90, g91 lines as suggested by Hu as that sounds like a good habit to have, add the stock allowance for surface grinding after heat treating and probably a g41 move changing my Y values to match. This should work until I can figure out a better way to machine the part with our equipment if there is one. Thanks Scott
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain |
|
#7
| ||||
| ||||
| Scott, Are you familiar with the M97 local sub call? If your subroutines are unique to each main program, it is probably more convenient to just load the subs in after the main program's M30. That way, there is no worrying about having program numbers available, because the subroutines exist within one program. The calling of a subroutine is basically the same except that you use an M97 in place of the M98. The P address called is simply a line number at the start of the sub. I do not otherwise use line numbers in my programs for anything except subroutine addresses, so this allows me to use a simple addresses like N100, N200 etc, without using an editor to discover what the literal line number might be, or worrying if the line number has changed after an edit. But you can use whatever you like. The subroutines are not named with a Ooooo program number.
__________________ 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) |
|
#8
| ||||
| ||||
| I have read about them in some of the reference books I have and have used them in my cad software for multiple pockets but never hand coded them. It would eliminate one concern such as deleting a sub program, or worse overwritting it with something inappropriate to this program. I have to stage the part, haven't wrote the portion from M00(xxx) on to allow moving it down on the fixture so it could end up being a nice little 3/4 printed page program. I think the long hand version is about 4pgs printed on legal paper. The block no. idea is a really good one. I like line numbers normally since it allows me to restart long programs the next morning if I have a part on the machine at the end of the day, but since that wouldn't be the case in this instance, and it is a short program to boot it would work well for this. On the same vein how do you do a restart in a program like this skipping to say the fourth repeat on the second sub? Would you just edit the program x,y start and decrease the repeats, or is there a better way?
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain |
|
#9
| ||||
| ||||
| I don't know of a surefire method to get to the middle of a repeat easily with minimal programming. If you think it will be a frequent occurance, then I suppose you should expand the number of fully written out calls to the sub within the main program, either eliminating the repeats altogether, or at least allowing you to get closer to where you want to be, with less air cutting time.
__________________ 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) |
|
#10
| ||||
| ||||
Thanks Hu
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain |
| Sponsored Links |
|
#11
| |||
| |||
| The subroutine calls are all near the top of what I designate the main part of the program and all it does is set the work zero and then call the sub so the structure is like this for three work zeroes and three tools: Name (Part description) Bunch of stuff G54 M97 P1000 /G55 M97 P1000 /G56 M97 P1000 -------- G54 M97 P2000 /G55 M97 P2000 /G56 M97 P2000 --------- G54 M97 P3000 /G55 M97 P3000 /G56 M97 P3000 --------- Bunch of stuff M30 --------- N1000 T1M06 Tool 1 operations M99 ---- N2000 T2M06 Tool 2 operations M99 ---- N2000 T3M06 Tool 3 operations M99 ---- Restart can be done anywhere, at any line within a subroutine or at the M97 command. If the restart is done in the subroutine the control uses the first subroutine call as the reference. In other words if I put in the restart on tool 2 right on the T2M06 line it would do the G54 location and continue from there. If I want to start in one of the other work zeroes the restart has to be done at the M97 line so a restart for tool 3 in G56 would start at G56 M97 P3000. The block deletes are to shut out the second and third work zeroes during setup so all the wear settings can be adjusted before doing multiple parts. I find this system convenient because line numbers match the tool number and it is easy to jump down to any part of the program. For instance the spindle on command is always the second or third line in the sub. Additional subroutine calls within the main subroutines use P1100, P1200 etc. You comment on a 3/4 page program. I have some that are about 600 lines just for the work zero designation and subroutine calls working with 11 tools at 32 different work zeroes with some work zeroes used at different angular positions on a rotating fixture. These were fun to write but one took a 45 minute part using three separate programs and fixtures down to just under 8 minutes and I have recouped the fifteen hours I spent combining the three existing programs many times over. Also recouped the ten days it took to build the fixture.
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
|
#12
| ||||
| ||||
| I see the benefit of using ea. as a sub so you can use run multiple parts at once plus any edit for one part is translated into the others by default, plus it keeps one tooling op going at once for ea. part so you don't waste a lot of time on tool changes. Could be pretty easy to edit some of my existing programs using multiple offsets to make them more effecient. It took things in a direction that hadn't occured to me yet. Working by myself in my situation leaves me feeling like I'm reinventing the wheel at times. Your comment on increased effiecency on the mutlisetups hits home. One thing I'm always worried about it cumilative tolerance errors with multiple setups. As I learn more this format will become more practical for me. Right now I'm settled on a pretty simple setup and program much like Hu suggested, but your example puts me in mind of an example I read. 100,000,000 holes in a grid pattern. A simple program with 6 lines and two subs (one per tool) of 11 and 10 lines each. Long hand it would take approximately 19yrs uninterupted to write. Hu, I think this is going to work well as you suggested I changed them to all subroutines using the haas manual to check my formating. It graphs well and checks against my print. Just couldn't make myself take that g90 out of the saftey line or seperate that g91 g28 z0.0 just looks wrong and bothers me. did seperate the other g91s as you suggested though. Thanks scott % O5000 (CTRC CUTTER BAR CAVITIES) (T01- D1.5IN SINGLE PT CUTTER CCW ROTATION) (MATERIAL- S7 TOOL STEEL) G20 G40 G49 G90 M6 T01 G43 H01 G0 G54 X-3.125 Y-3.25 M04 S670 G0 Z.25 M08 M97 P0100 L10 M97 P0200 L11 M09 M05 G91 G28 Z0.00 M00 (INDEX STOCK DOWN ON FIXTURE) G90 G0 X-3.125 Y-3.25 M04 S670 G0 Z.25 M08 M97 P0100 L10 M97 P0200 L10 M09 M05 G91 G28 Z0.0 M30 N0100(CTRC CUTTER BAR SUB01) G91 G1 Y0.076 F10.0 Z-2.75 F2.7 Y-.076 F10.0 G0 Z2.75 Y0.076 M99 N0200(CTRC CUTTER BAR SUB02) G91 G0 X-1.875 Y-.76 M98 P7001 L10 M99 %
__________________ Suppose you were an idiot and suppose you were a member of Congress. But I repeat myself. Mark Twain Last edited by Shotout; 11-27-2007 at 10:15 AM. Reason: forgot to paste code |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help tring to cut hex using c x moves | DryRun | G-Code Programing | 7 | 09-30-2007 05:15 AM |
| Graph problem | afterburn25 | Haas Mills | 2 | 04-12-2007 08:38 AM |
| Rapid moves G00 | dicksonhof | Mach Software (ArtSoft software) | 9 | 11-07-2006 09:21 AM |
| Z position moves up during run | henryj1951 | Gecko Drives | 3 | 03-27-2006 05:16 PM |
| Traffic Ranking Graph | cbcnc | Forum Questions or Problems | 3 | 06-20-2004 03:52 PM |