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 05-29-2009, 05:02 AM
 
Join Date: May 2009
Location: south africa
Posts: 12
warren01 is on a distinguished road
fanuc subprogramming

i would like to know what is the subprogramming sequence for a part program that has 4 slots at 10mm deep and 15mm wide (from start to M30)
Reply With Quote

  #2   Ban this user!
Old 05-29-2009, 02:24 PM
 
Join Date: Mar 2005
Location: Silicon Valley, CA
Posts: 982
psychomill is on a distinguished road

M98


..... you're leaving out way too many details here ....
__________________
It's just a part..... cutter still goes round and round....
Reply With Quote

  #3   Ban this user!
Old 05-30-2009, 11:26 PM
 
Join Date: May 2009
Location: USA
Posts: 3
xEstrnDrgnx is on a distinguished road

need more info. , size of blank (material thickness x width x length)
(with and length of the slots and distance center to
center of the slot, also the offset from the edge of the
stock.)
Reply With Quote

  #4   Ban this user!
Old 06-01-2009, 04:02 AM
 
Join Date: May 2009
Location: south africa
Posts: 12
warren01 is on a distinguished road
part detail

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)
Reply With Quote

  #5   Ban this user!
Old 06-01-2009, 08:53 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

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
If you have code that does (or can) repeat, cut it out into a separate program and call it as a sub. Make sure to keep track of modal commands going into and out of the subs. Like G1/G0 and G90/G91 ect. in this sample.


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.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 06-03-2009, 04:06 PM
 
Join Date: May 2005
Location: USA
Posts: 66
titchener is on a distinguished road

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.
Reply With Quote

  #7   Ban this user!
Old 06-03-2009, 07:55 PM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

Originally Posted by titchener View Post
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?)


Far as I know subprograms on a Fanuc can have any program number from 1 to 9999.


Originally Posted by titchener View Post
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?


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.


Originally Posted by titchener View Post
Is there a convention for how you name the files containing subroutines?

Thanks,

Paul T.


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.
Reply With Quote

  #8   Ban this user!
Old 06-04-2009, 07:20 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by titchener View Post
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?
Paul,
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
Reply With Quote

  #9   Ban this user!
Old 06-04-2009, 03:27 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

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
Reply With Quote

  #10   Ban this user!
Old 06-05-2009, 06:56 AM
 
Join Date: Jan 2005
Location: USA
Posts: 237
cogsman1 is on a distinguished road
Possible but different

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
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 06-05-2009, 07:29 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by dpuch View Post
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.
Yes that can be a big restriction. The other thing is not all controls are equipped with a PCMCIA card. So it would depend on the control model that Warren is using.

Originally Posted by cogsman1 View Post
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.

This works I use it all the time. If you do NOT have the Macro option it will not understand the "GOTO" statements
Cogsman,
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
Reply With Quote

  #12   Ban this user!
Old 06-05-2009, 11:19 AM
beege's Avatar  
Join Date: Feb 2008
Location: USA
Posts: 518
beege is on a distinguished road

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.
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
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




All times are GMT -5. The time now is 12:17 AM.





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 354 355 356 357 358 359 360 361