![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#4
| |||
| |||
Sorry guys 4 not giving more detail.I'm new to subprogramming.Hope this is what you need.part size(300x300).material thickness(70mm).slot offset from edge(30mm).slot depth(10mm),width(15mm).distance center to center of the slot(25mm) |
|
#5
| |||
| |||
| A rough outline of the code (not using your real location/sizes) Code: G90 G0 X10.0 Y5.0 (position for first pocket) M98 P101 (call sub program) G0 X20.0 Y5.0 M98 P101 G0 X30.0 Y5.0 M98 P101 G0 X40.0 Y5.0 M98 P101 Code: O0101 (Sub to cut pocket in incremental) G91 G1 X5.0 Z-1.0 F3.0 (... pocket) G90 M99 How and why you do this with your code is based on what your doing and why. Although usually space is a main reason. Another is reduced complexity when reading the main program. IE. 50 lines for the pocket replaced by a sub call and a comment if your nice. |
| Sponsored Links |
|
#6
| |||
| |||
| I'm trying to write some G code macros that will run on as many different controllers as possible, so here's some more questions regarding Fanuc subroutine calls. Is there a limit in the range of subroutine numbers that can be called, ie: O1234 (Does this number have to be in a subrange?) On Fanucs, is the method to call a "local" subroutine (ie in the same file) the same as the method to call a subroutine located in a separate file? Is there a convention for how you name the files containing subroutines? Thanks, Paul T. |
|
#7
| |||||
| |||||
Far as I know subprograms on a Fanuc can have any program number from 1 to 9999. As far as I know (I hate speaking in absolutes. I could be wrong!), it is impossible to have 2 programs in the same file. Doesn't matter whether they are subs or not. Each program has its own program number, and thus is a SEPARATE file. No. You decide how to arrange them. There are parameters that allow you to run subprograms with a G, an M or a T call. I don't use the T-call for obvious reasons. Each parameter is associated with a SPECIFIC program number. These are all 9000 series protected programs (9000-9029). You may want to take advantage of these calls, but it is your choice what type of subprograms you want associated with each series of program numbers. As an example Hardinge uses Safe Index Subprograms O1, O2 (front spindle), and O3, O4 (subspindle). I put them in O9001, O9002, O9003 and O9004 to keep them from being modified or accidentally deleted. Turns out these programs can be called with an M. So now I use M91, M92, M93 and M94 instead of M98P9001, M98P9002, etc. to call them. Hardinge has a couple deep drilling subroutines that come with their lathes. The older version is O9135, the newer version O9136 so when I wrote my own macro drill program I called it O9134. |
|
#8
| |||
| |||
| With Fanuc you cannot call a subroutine and have that same subroutine located in your calling program. If you are running program O1234 and you want to call a subroutine O9000 this can be done via M98P9000 or G65P9000. However this 9000 program has to be a separate program. You might be thinking of Haas because they have the ability of calling a subroutine in the same program. If you use a M97P9000 you can have program 9000 and 1234 combined. The M97P9000 will search within program 1234 for 9000. If you use M98P9000 it will search externally for program 9000. Dale, You were correct. Sometimes we know more then we think. Or is it we think we know more then we really do. I like the first one better .Stevo |
|
#9
| |||
| |||
| A bit off topic I think, but if space is a reason for calling subs, another way to "extend" your memory is to use the PCMCIA card as added storage. You have to change you I/O channel to the card and there are limits to what can be in the g-code on the card. Your main program is in normal memory, and uses a special call to pull the subs from the card. What I have done in the past is make the bulk of a single tool (movement type code only) a sub program. Ah, just looked it up again. "DNC by PCMCIA" for fanuc 16i, 18i ans 20i M198 The main restriction is that the card program can not call any other subs in any way. We use subs for M6 and a few other things, so that is why I split the movement code as the subs on the card. Last edited by dpuch; 06-04-2009 at 03:37 PM. Reason: added details |
|
#10
| |||
| |||
I think I understand where you are coming from. I run many machines with mitsubishi controls and they have the ability to keep sub routines within the main program. This allows for a part program to contain everything i needs. exam: M98H# wil hop to a place within the program that contains the N# that the H# refers to, when done M99 sends you back to the line following the "M98" line to continue with the program. That exact format does not work in a Fanuc BUT you can create a program that will give you that result, as long as you have Macro option. On the Fanuc you will have to use "M99P#" to make the program hop to "N#" like the M98H# did above. The return is where the biggest change will be. Using "M99" will NOT return you to the line following the "M99P#", it will return you to the start of the program. You will need to use a "GOTO#" statement and have a line following the "M99P#" with a "N#" to match the "#" on the GOTO# line. Here is an example. " " " M99P123 (GOT TO N123) N321 " " " N123(sub-routine) " " " GOTO321 (GO TO N321) This works I use it all the time. If you do NOT have the Macro option it will not understand the "GOTO" statements |
| Sponsored Links |
|
#11
| ||||
| ||||
Why the M99P123? If you are going to stay in the same program why not just use your GOTO’s to achieve this? I am just curious as to the reasoning. GOTO123 N321 … N123 … GOTO321 Stevo |
|
#12
| ||||
| ||||
| Stevo1, I think he meant it was easier to use the M99P## if you don't have Macro B. IIIRC, the Macro A format was G65H(something)P## for a GOTO statement. It's been a very long time since I used or even seen in a manual the Macro A format. Also, I think a negative P (M99P-123) will look backwards for the line number and save a tiny bit of time. |
![]() |
| 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 |
| GE Fanuc & FANUC proprietary posts | CNCadmin | Fanuc | 44 | 01-05-2012 08:54 AM |
| subprogramming in masterCAM x2 post | daffyff | Post Processor Files | 2 | 03-13-2009 04:17 PM |
| Fanuc & GE Fanuc Repairs | RRL | Product Announcements & Manufacturer News | 0 | 10-01-2008 12:42 PM |
| Subprogramming | hitachi | General CAM Discussion | 3 | 06-17-2006 09:09 AM |