![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Fanuc Discuss Fanuc controllers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Back to Fanuc after using much more modern controllers ![]() Use to storing my sub program's within my main program, just makes it easier to read and saves on the program numbers. Problem, can't get the controller to except another "O" value in the main program. Ex. O0100 n1 G00 X0 Z0: blah blah blah m98 P1000; m30; O1000 (sub) <--- Can't add this line m99; Anyways it's been awhile, am I missing something or can you just not do it with Fanuc? |
|
#3
| |||
| |||
| Your format is not correct for a fanuc control. If you want to add a program, startat the top of the page in edit, O1000, insert. This will install the program number at the top of the page, build the program. When you want to call this program "M98 P1000". |
|
#4
| |||
| |||
| Think your missing the point Whiz, I want too include sub-program's in my main program. This way the operator can see all the code in edit mode, and not have to call up the sub-program seperate. I will try it via PC and memory card Newtex, thxs |
|
#5
| ||||
| ||||
| I think you could do it using N numbers after the M30, and using M99 instead of M98, although I've never tried it. Sounds like a lot of extra work to me. O1000 ... ... M99P1001(JUMP TO N1001) N2 ... ... M99P1002(JUMP TO N1002) N3 ... ... M30 N1001(SUB 1) ... ... M99P2(JUMP TO N2) N1002(SUB 2) ... ... M99P3(JUMP TO N3) |
| Sponsored Links |
|
#6
| |||
| |||
If you want sub routines within the main, you'll have re-write the way your program utilizes them. Dcoupar's post is one example. There are several other ways of doing this too. Now, supposedly, on the 30/31/32 controls allow file name storing in the control which may allow multiple programs under "one roof". Don't know for sure though....
__________________ It's just a part..... cutter still goes round and round.... |
|
#7
| |||
| |||
| Jdavis what exactly did you what to do with this sub program inside your main program? bar load ? only do a certain operations? posting your real main and sub program would help. Onto my suggestion you could use macro variables for counting parts or by used up material , an example would go like this. O1000 G0 G80 G28U0. Z10. #501=20(#501 PARTS REQUIRED) TXXXX G0X**Z** G1 *** G0 G28U0. Z10. M1 #500=#500+1(#500= AMOUNT OF PARTS RAN #501= PARTS REQUIRED) IF[#500 EQ #501]GOTO300 /M99 M30 N300TXXXX G0X**.Z** G1***(TOOL DOES IT'S THING) G0G28U0. Z10. M1 (TOOL DONE DOING IT'S THING) #500=0( ZERO OUT #500 COUNTER) M99(Go back to the top of the program) I hope this will help for your app. and there are other macro variables you can add to this program to make the program more flexable when to stop the program , this is just a start and my kids are in a fight now so I have to go and break it up. |
|
#9
| ||||
| ||||
| Nope...won't do it...the only thing I can tell ya is tell them to use backround edit. the only place you can keep those in one file is on the PC...I've never seen any controller that can...The closest thing to it is the haas with the m97 and n #'s never seen that on a yasnac or any eia based control either...everytime the control reads an O it seperates it |
|
#10
| |||
| |||
| Try as "Dcoupar" showed. I use that format all the time. works great. My Mitsubishi controls make it easier with M98H### but on the Fanuc you need to use M99P### and then follow with an "N### to return to at the end of your sub program. M99P1 (HOP TO N1) N2 M2 N1(SUB-PROGRAM) T0100 . . M99P2(HOP TO N2)(RETURN) |
| Sponsored Links |
|
#11
| |||
| |||
| A more complicated version using a stack to save the N position to return to allowing multiple calls to one sub. Code: O1000(MAIN PROG) #100=100(INITIALIZE STACK POINTER) G0X0.0 G0X1.0 #100=#100+1(PUSH) ##100=1(RETURN LOCATION) M99P1000(JUMP TO N1000 SUB 1) N1 #100=#100-1(POP) G0X2.0 #100=#100+1(PUSH) ##100=2(RETURN LOCATION) M99P1000(JUMP TO N1000 SUB 1) N2 #100=#100-1(POP) G0X3.0 #100=#100+1(PUSH) ##100=3(RETURN LOCATION) M99P1000(JUMP TO N1000 SUB 1) N3 #100=#100-1(POP) G0X4.0 M30 N1000(SUB 1) G0X11.0 #100=#100+1(PUSH) ##100=1001(RETURN LOCATION) M99P2000(JUMP TO N2000 SUB 2) N1001 #100=#100-1(POP) G0X12.0 #100=#100+1(PUSH) ##100=1002(RETURN LOCATION) M99P2000(JUMP TO N2000 SUB 2) N1002 #100=#100-1(POP) G0X13.0 M99P##100(RETURN) N2000(SUB 2) G0X21.0 M99P##100(RETURN) |
![]() |
| 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 |
| fanuc 21iT.401 Alarm | BKCOM | Fanuc | 3 | 11-15-2007 02:39 AM |
| FANUC 21iT | fjd | Fanuc | 4 | 08-25-2007 08:12 AM |
| Storing a K2 Out in the Shed.. | GuitarEng | Commercial CNC Wood Routers | 5 | 12-09-2006 01:38 PM |
| storing mazatrol programs | laamar | General CNC (Mill and Lathe) Control Software (NC) | 3 | 03-10-2005 11:43 PM |