![]() | |
| 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 |
|
#1
| |||
| |||
Hi Guys, I haven't been here in a while, just a quickie regarding subroutines. Currently I write a few different types, Fanuc, Fagor, Camsoft. I'm wondering if it's possible to have a subroutine at the end of the normal program, which is what our Fagor lathe is like, it would be entered M98 P4110 so it would jump to LINE 110 and run it 4 times. With the Fanuc I'm using M98 P0110 L2 and it will OPEN program number O0110 and run it 4 times. I just really like all of the program together, in the one file, rather than opening another program (subroutine). Did that make any sense? |
|
#2
| ||||
| ||||
| Darc, Some Fanuc's will run a "local" sub. Example would be : M97 P110 L4 (local sub call) So the M97 is the local sub call. The Pxxxx is the line number of the start of the sub program. The L4 would loop the sub 4 times. The "sub" lines go after the M30 and must have a M99 end line. Same as a normal sub.
__________________ (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#3
| |||
| |||
| a fagor control can do that you dont even need to make it an actual sub routine just write the lines you want to run in repatition at the bottom after your M30 and be sure to lable the first and last line/block to be read, then insert the high level language line (RPT N?,N?)N# of times to run.you can even faNcy it up and use the parameters to make one program work for lots of differnt parts. HERE IS AN EXAMPLE OF A PROGRAM TO GRIND THE OD OF PARTS OF DIFFERNENT DIAMETERS, LENGTHS,AND MATERIAL TYPE. WITH A LATH YOU COULD CHANGE THE DRESSING TO A TOOL CHANGE OR USE IT TO CHANGE FEEDS/SPEEDS/AND DEPTH OF CUT. % ROUGH/FINISH DIAMETER ON A CYLINDRICAL GRINDER WITH AUTO DRESSING ,MX (P114=.70000 ); ROUGH DIAMETER (P101=.56000); FINNISH DIAMETER (P103=1.75000); OVER ALL LENGTH (P104= .0005 ); STOCK REMOVAL PER SURFACE (P126= -.1000 ); SHORTEN LEFT SIDE GRIND LENGTH (P112= 28 ); SFPM OF GAGE DIAMETER (P3= 1 );PART COUNT (P296= 47 ); TOOL NUMBER (P283= 0 ); RUN FINNISH DIAM PASSES 1=ON / 0=OFF (P284= 1 ); IS STOCK OUT OF ROUND (SQUARE OR HEX)1=YES 0=NO (P285= 0 ); FINNISH DIAM ONLY 1=YES 0=NO (P213= 6 ); NUMBER OF PASSES ON DRESS (P173= 1.75000); SET UP PIECE OVERALL LENGTH (P145= .3650); OUT OF ROUND AMOUNT (P146= 0); AMOUNT TO LEAVE FOR PREE FINISH (P286= 0 );DRESS AFTER OUT OF ROUND 1=YES 0=NO (P287= 1 ); DRESS AFTER PRE-FINISH 1=YES 0=NO (P288= 0 );DRESS AFTER FINISH 1=YES 0=NO ;---------------------------WHEEL SPECES-------------------------------------- (P201 =NOSEW(P296) ); WHEEL WIDTH (P202 =TOR(P296)); CORNER RADIUS (P203 = .0300 ); DIAMOND RADIUS (P204 = P201+2*P203) (P205 = P202+P203); DRESS RADIUS, RH I (P206 = P205*SIN47); LH I, LH K (P207 = P205-(P205*COS47)) (P208 = P204-(2*P206)); FLAT ON WHEEL ;--------------------------CALCULATIONS---------------------------------------- (P174=P103-P173); (P127=P126+P202); (P144= .05); CLEARANCE AMOUNT (P111=P114+P144); (P113=((P112*12)/(P101*3.141))*2); S FOR WORK HEAD (P115=P114-P101); STOCK TO BE REMOVED (P118=P104*2) (P119=P118*2); DIAM REDUCTION PER OUT OF ROUND PASS (P116=(FUP(P115/P118))-1); NUM OF PASSES FOR PRE-FINISH (P138=P101+(P118*P116)+(P104*P146)); (P105=(P103-P201)/2); ACTUAL GRIND LENGTH (P117=P105+P202); HALF O.A. G L (P137=P117-P127); L GRIND LENGTH (P140=P117+P144); (P141=P117+(P144*2)); (P120= P101+(P146*P118)); PRE FINNISH DIAM. (P170=P114+P145); OUT OF ROUND IN FEED AMOUNT (P171=(FUP(P145/P119))); NUMBER OF OUT OF ROUND PASSES (P172=(P170+P144)); OUT OF ROUND CLEARANCE (P139=P137+P117);ADJUSTED GRIND LENGTH (P142=P137+P140); (P143=P137+P141); ;------------------FEED RATES-------------------------------------------------- (P5=CNCFRO) (IF (P5 EQ 0)P14=1.0 ELSE P14=P5/100) ;----------------------------PROG. CONFLICTS----------------------------------- ; ; ; ;------------------------PROGRAM----------------------------------------------- M8 G54 (ORGZ54=ORGZ54+P174) G54 TP296 G90 Z0 X4.0 G97 F20.0 SP113 M3 (IF (P284 EQ 1)GOTO N1); (IF (P285 EQ 1)GOTO N3 ELSE GOTO N2); N1 G1 XP172 Z-P137 G91 G1 X-P144 F12.5 (RPT N10,N20)NP171; OUT OF ROUND PASSES -------- HERE IS THE FIRST--- ;G1 Z0.0 G90 G1 X4.0 Z0 (P213= 7); NUMBER OF DRESS PASSES AFTER OUT OF ROUND GRIND (P210=.001); DRESS DEPTH (IF (P286 EQ 1)PCALL 210); OUT OF ROUND DRESS G54 Z0 G97 SP113 M3 G90 G1 X4.0 Z0 N2 G90 G1 XP111 Z-P137 G1 XP138 Z-P137 (RPT N30,N40)NP116; -----------HERE IS THE COMMAND LINE --------- G90 G1 X4.0 Z0 (P213= 6); NUMBER OF DRESS PASSES AFTER PRE-FINISH (P210=.0007); DRESS DEPTH (IF (P287 EQ 1)PCALL 210); G54 Z0 G97 SP113 M3 (IF (P283 EQ 0)GOTO N99); G90 G1 X4.0 Z0 N3 G90 G1 XP120 Z-P137 (RPT N50,N60)NP146; -------------HERE IS ANOTHER ---------------------- G90 G00 X4.0 Z0 (P213= 4); NUMBER OF DRESS PASSES AFTER FINISH (IF (P288 EQ 1)PCALL 210); (IF (P282 GE P3)PCALL P210); DRESS SUB CONDITION (MSG "PROG COMPLETE W/ ,?P282 PARTS ON DRESS") G54 Z0 (RET) N99 M30 N10 G91 G1 X-P118 ZP139 F48.5000 ----- HERE IS THE FIRST ------------ N20 G91 G1 X-P118 Z-P139 (RET) M30 N30 G91 G1 X-P104 ZP142 F37.500 -------- HERE ----------------- N40 G91 G1 X-P104 Z-P142 (RET) M30 N50 G91 G1 X-P104 ZP143 F22.500; ------ HERE -------------------- N60 G91 G1 X-P104 Z-P143 (RET) M30 |
![]() |
| 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 |
| Need help with subroutine | 2_jammer | General CAM Discussion | 1 | 01-17-2005 11:46 PM |
| Lathe programing help | smitty | TurboCNC | 24 | 06-23-2003 11:39 AM |