CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 01-31-2005, 03:26 AM
 
Join Date: Sep 2004
Location: Australia
Posts: 196
Darc is on a distinguished road
Need help with a subroutine formulae...

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?
Tweet this Post!Share on Facebook
Reply With Quote

  #2  
Old 01-31-2005, 01:23 PM
wms's Avatar
wms wms is offline
Moderator
 
Join Date: Mar 2003
Location: United States
Posts: 938
wms is on a distinguished road

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)
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 01-09-2006, 06:05 PM
 
Join Date: Dec 2005
Location: us
Posts: 2
GETHERMC is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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




All times are GMT -5. The time now is 10:47 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353