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


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 11-15-2011, 02:37 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road
LOADING SUBPROGRAMS WITHIN A MAIN PROGRAM

Hello Zoners,
I want to be able to send a subprogram, within a main program, without my control separating them into two different programs. I've tried to use the chain command, but that means I have to send one and then send the other. Is it possible for me to send the two or three as a whole all at once. I am attaching a program as an example.......
Thanks,
Picman

2011: (PROVEN 10-24-2011 18:21:43)

:2011(DEFECTOR BOLT FOR MFC MILL SLOT IN TAPERED SHAFT)
(MAIN PROGRAM MULTIPLE OFF-SETS SEVERAL JOBS)
(REMEMBER TO ALTER P NUMBER IF NEEDED FOR SUB)
(LEADWELL/ JOHNFORD MACHINE FANUC 18M)
(.219" DIA. DRILL)
(TOOL #1)
N100G00G80G91G28Z0
N101G90G54
N102M98P2000
N103G00G40G80Z1.0
N104G90G55
N105M98P2000
N106G00G40G80Z1.0
N107G90G56
N108M98P2000
N109G00G40G80Z1.0
N110G90G57
N111M98P2000
N112G00G40G80Z1.0
N119G80G91G28Z0M09
N121G90G0Y-12.0M01
N122M05
N123M00

(.250" HANITA VARI MILL)
(TOOL #2)
N100G00G80G91G28Z0
N101G90G54
N102M98P2001
N103G00G40Z1.0
N104G90G55
N105M98P2001
N106G00G40Z1.0
N107G90G56
N108M98P2001
N109G00G40Z1.0
N110G90G57
N111M98P2001
N112G00G40Z1.0
N119G80G91G28Z0M09
N121G90G0Y-12.0M01
N122M05
N123M30

O2000
(SUBROUTINE NUMBER OXXXX)
(SUBROUTINE)
(TOOL #1)
N106S1000M03
N107G00X0Y0
N108G43Z1.0H1M08
N109G98G83Z-.6907R.1Q.125F3.5
N110G80
N111M99

O2001
(SUBROUTINE NUMBER OXXXX)
(SUBROUTINE)
(TOOL #2)
N206S4500M03
N207G00X0Y0
N208G43Z1.0H2M08
N209G00Z.1

(PASS #1)
N210G01Z-.084F25.0
N211X.677
N212G00Z1.0
N213X0

(PASS #2)
N214Z.1
N215G01Z-.168F25.0
N216X.677
N217G00Z1.0
N218X0

(PASS #3)
N219Z.1
N220G01Z-.261F25.0
N221X.677
N222G00Z1.0
N223X0

(PASS #4)
N224Z.1
N225G01Z-.354F25.0
N226X.677
N227G00Z1.0
N228X0

(PASS #5)
N229Z.1
N230G01Z-.447F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #6)
N229Z.1
N230G01Z-.54F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #7)
N229Z.1
N230G01Z-.633F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #8)
N234Z.1
N235G01Z-.675F25.0
N236X.677
N237M99
Reply With Quote

  #2   Ban this user!
Old 11-15-2011, 03:42 PM
beege's Avatar  
Join Date: Feb 2008
Location: USA
Posts: 518
beege is on a distinguished road

Pretty much no. One O word per program. What control? What machine? The only way to do what you ask in a fanuc is using branching (GOTO) lines or M99 jump lines to bounce around the program. Do you have macro B?
Reply With Quote

  #3   Ban this user!
Old 11-17-2011, 01:53 AM
fordav11's Avatar  
Join Date: Aug 2011
Location: Fordaville
Posts: 939
fordav11 is on a distinguished road

you say 'send the two or three as a whole all at once'

if you mean punch out multiple programs, just delete all the programs in the memory EXCEPT those you want to keep together (or punch unwanted programs then delete) then type.....
O-9999 then press PUNCH

Everything in the memory will be punched out in one file

The outputted file will be one file and it will contain the main and subs. when you read it back in it will be in the control the same as it originally was (i.e. separate programs)
Reply With Quote

  #4   Ban this user!
Old 11-17-2011, 01:57 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road

nice one, but know I meant read or sending the prog to my machine not punching from
__________________
Picman
"Never look a bounty hunter in the eyes"
Reply With Quote

  #5   Ban this user!
Old 11-17-2011, 03:27 PM
fordav11's Avatar  
Join Date: Aug 2011
Location: Fordaville
Posts: 939
fordav11 is on a distinguished road

read or send from what? a PC? If yes just create the file and include all of the programs. when you read it the CNC will have all of the programs in its memory. It sees the O's and creates a new program for every O. A file can contain multiple programs and the CNC will split them up into separate programs when it reads them in.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 11-17-2011, 03:32 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road

i do understand this but, when i punch them back to my pc i want them as a whole. i dont want my machine to separate them. if i could just punch one program back it would make my life a lil bit easier. if it's not possible it's cool. i just thought it would be handy.
__________________
Picman
"Never look a bounty hunter in the eyes"
Reply With Quote

  #7   Ban this user!
Old 11-17-2011, 08:34 PM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by PICMAN View Post
i do understand this but, when i punch them back to my pc i want them as a whole. i dont want my machine to separate them. if i could just punch one program back it would make my life a lil bit easier. if it's not possible it's cool. i just thought it would be handy.
I comprehend this the same way Ford is, and he's quite correct. Some controls have ALL and THIS softkeys with regards to sending from the control to an external device, but the O-9999 suggested by Ford work on all.

If you punch (send) all the programs back to an external device, frequently a PC, unless steps are taken at the PC to do otherwise, all the programs in the control's memory will be received as one program containing all the individual programs held in the control's memory. In many PC communication applications there is a function available to separate programs from one large program containing many individual programs on the basis of a preset character. With Fanuc controls, its either the character "O" or ":". However, in most cases the many programs being sent from the control will be received as one file.

As Ford stated, with no action on your part whatsoever, if you were to send this one long program containing many programs back to the control, the control will split it back into the many individual programs again, and it does this based on the "O" contained in the one large program.

If you want to have Sub programs all contained in one program in the way the HAAS control does, then you will have to remove all occurrences of "O"and ":", except for the first at the head of the program, and do as Beege suggested with the GOTO or M99 statements. This method required attention to detail with regards to sequence numbering.

Regards,

Bill

Last edited by angelw; 11-17-2011 at 09:08 PM.
Reply With Quote

  #8   Ban this user!
Old 11-17-2011, 08:40 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road

do tell please give me an example?
__________________
Picman
"Never look a bounty hunter in the eyes"
Reply With Quote

  #9   Ban this user!
Old 11-17-2011, 08:42 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road
Like This?

2011: (PROVEN 10-24-2011 18:21:43)

:2011(DEFECTOR BOLT FOR MFC MILL SLOT IN TAPERED SHAFT)
(MAIN PROGRAM MULTIPLE OFF-SETS SEVERAL JOBS)
(REMEMBER TO ALTER P NUMBER IF NEEDED FOR SUB)
(LEADWELL/ JOHNFORD MACHINE FANUC 18M)
(.219" DIA. DRILL)
(TOOL #1)
N100G00G80G91G28Z0
N101G90G54
N102M98P2000
N103G00G40G80Z1.0
N104G90G55
N105M98P2000
N106G00G40G80Z1.0
N107G90G56
N108M98P2000
N109G00G40G80Z1.0
N110G90G57
N111M98P2000
N112G00G40G80Z1.0
N119G80G91G28Z0M09
N121G90G0Y-12.0M01
N122M05
N123M00

(.250" HANITA VARI MILL)
(TOOL #2)
N100G00G80G91G28Z0
N101G90G54
N102M98P2001
N103G00G40Z1.0
N104G90G55
N105M98P2001
N106G00G40Z1.0
N107G90G56
N108M98P2001
N109G00G40Z1.0
N110G90G57
N111M98P2001
N112G00G40Z1.0
N119G80G91G28Z0M09
N121G90G0Y-12.0M01
N122M05
N123M30

2000
(SUBROUTINE NUMBER OXXXX)
(SUBROUTINE)
(TOOL #1)
N106S1000M03
N107G00X0Y0
N108G43Z1.0H1M08
N109G98G83Z-.6907R.1Q.125F3.5
N110G80
N111M99

2001
(SUBROUTINE NUMBER OXXXX)
(SUBROUTINE)
(TOOL #2)
N206S4500M03
N207G00X0Y0
N208G43Z1.0H2M08
N209G00Z.1

(PASS #1)
N210G01Z-.084F25.0
N211X.677
N212G00Z1.0
N213X0

(PASS #2)
N214Z.1
N215G01Z-.168F25.0
N216X.677
N217G00Z1.0
N218X0

(PASS #3)
N219Z.1
N220G01Z-.261F25.0
N221X.677
N222G00Z1.0
N223X0

(PASS #4)
N224Z.1
N225G01Z-.354F25.0
N226X.677
N227G00Z1.0
N228X0

(PASS #5)
N229Z.1
N230G01Z-.447F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #6)
N229Z.1
N230G01Z-.54F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #7)
N229Z.1
N230G01Z-.633F25.0
N231X.677
N232G00Z1.0
N233X0

(PASS #8)
N234Z.1
N235G01Z-.675F25.0
N236X.677
N237M99
__________________
Picman
"Never look a bounty hunter in the eyes"
Reply With Quote

  #10   Ban this user!
Old 11-17-2011, 09:05 PM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Get rid of all sequence numbers except for those at the start of each tool and at the start of what will be your pseudo Sub programs. In my opinion, except where sequence number are mandatory, they only consume memory. In normal circumstances I only use a sequence number at the start of each new tool.

In the following example, I've used a variable for the return number. It will give you the flexibility to return to any where in the program from your pseudo subs.

Regards,

Bill

%
O1000
(MAIN PROGRAM)
N1 G00 G17 G21 G40 G49 G80
G91 G28 Z0.0
G28 Y0.0
T01 M06
S2500 M03
....................
....................
....................
#1=1001
GOTO 2000 (CALL PSEUDO SUBPROGRAM LINE N2000)
N1001 (RETURN FROM SUB AND CONTINUE FROM HERE)
....................
....................
....................
#1=1002
GOTO 2000 (CALL PSEUDO SUBPROGRAM LINE N2000)
N1002 (RETURN FROM SUB AND CONTINUE FROM HERE)
....................
....................
....................
#1=1003
GOTO 3000 (CALL PSEUDO SUBPROGRAM LINE N3000)
N1003 (RETURN FROM SUB AND CONTINUE FROM HERE)
....................
....................
....................
M30

N2000
(PSEUDO SUB 2000)
....................
....................
....................
GOTO #1

N3000
(PSEUDO SUB 3000)
....................
....................
....................
GOTO #1
%
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 11-17-2011, 10:32 PM
PICMAN's Avatar  
Join Date: Aug 2005
Location: USA
Age: 34
Posts: 54
PICMAN is on a distinguished road

i've never programmed in that way, but is helpful and interesting. i do appreciate the educational experience. i will try it and if you dont mind, i will let you know how it works out for me. \m/
THANKS
__________________
Picman
"Never look a bounty hunter in the eyes"
Reply With Quote

  #12   Ban this user!
Old 11-17-2011, 10:36 PM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Following is your program modified so as to jump from Main to Pseudo Sub and return using GOTO statement. There are other ways, this is but one.

If this is a real program that you use, test thoroughly before use. I didn't spend much time on it, but I believe it will be OK to use, if it was previously.

Care must be taken if restarting the program mid program. Ensure that #1 is set to the correct return line number.


Regards,

Bill






%
O2011(DEFECTOR BOLT FOR MFC MILL SLOT IN TAPERED SHAFT)
(MAIN PROGRAM MULTIPLE OFF-SETS SEVERAL JOBS)
(REMEMBER TO ALTER P NUMBER IF NEEDED FOR SUB)
(LEADWELL/ JOHNFORD MACHINE FANUC 18M)
(.219" DIA. DRILL)
(TOOL #1)
N1 G00 G80 G91 G28 Z0
G90 G54
#1 = 1001
GOTO 2000
N1001 G00 G40 G80 Z1.0
G90 G55
#1 = 1002
GOTO 2000
N1002 G00 G40 G80 Z1.0
G90 G56
#1 = 1003
GOTO 2000
N1003 G00 G40 G80 Z1.0
G90 G57
#1 = 1004
GOTO 2000
N1004 G00 G40 G80 Z1.0
G80 G91 G28 Z0 M09
G90 G0 Y-12.0 M01
M05
M00

(.250" HANITA VARI MILL)
(TOOL #2)
N2 G00 G80 G91 G28 Z0
G90 G54
#1 = 1005
GOTO 2001
N1005 G00 G40 Z1.0
G90 G55
#1 = 1006
GOTO 2001
N1006 G00 G40 Z1.0
G90 G56
#1 = 1007
GOTO 2001
N1007 G00 G40 Z1.0
G90 G57
#1 = 1008
GOTO 2001
N1008 G00 G40 Z1.0
G80 G91 G28 Z0 M09
G90 G0 Y-12.0 M01
M05
M30

N2000
(PSEUDO SUBROUTINE NUMBER 2000)
(SUBROUTINE)
(TOOL #1)
S1000 M03
G00 X0 Y0
G43 Z1.0 H1 M08
G98 G83 Z-.6907 R.1 Q.125 F3.5
G80
GOTO #1 (RETURN TO MIAN PROGRAM)

N2001
(PSEUDO SUBROUTINE NUMBER 2001)
(SUBROUTINE)
(TOOL #2)
S4500 M03
G00 X0 Y0
G43 Z1.0 H2 M08
G00 Z.1
(PASS #1)
G01 Z-.084 F25.0
X.677
G00 Z1.0
X0
(PASS #2)
Z.1
G01 Z-.168 F25.0
X.677
G00 Z1.0
X0
(PASS #3)
Z.1
G01 Z-.261 F25.0
X.677
G00 Z1.0
X0
(PASS #4)
Z.1
G01 Z-.354 F25.0
X.677
G00 Z1.0
X0
(PASS #5)
Z.1
G01 Z-.447 F25.0
X.677
G00 Z1.0
X0
(PASS #6)
Z.1
G01 Z-.54 F25.0
X.677
G00 Z1.0
X0
(PASS #7)
Z.1
G01 Z-.633 F25.0
X.677
G00 Z1.0
X0
(PASS #8)
Z.1
G01 Z-.675 F25.0
X.677
GOTO #1 (RETURN TO MAIN PROGRAM)
%

Last edited by angelw; 11-18-2011 at 02:06 AM.
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
Absolute Main Program, Incremental Sub eliot15 GibbsCAM 0 10-18-2011 04:31 PM
Main program vs. subroutine info for Hass VF fattybean G-Code Programing 5 01-09-2011 07:18 PM
How to subprogram edge find into main program petrarmb EDM Machines 0 12-07-2010 04:28 PM
Storing Sub-program within main on 21iT? Jdavis733 Fanuc 10 02-12-2008 11:56 AM
Fanuc output program + subprograms Mr_T Fanuc 9 11-29-2005 12:21 AM




All times are GMT -5. The time now is 07:30 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 354 355 356 357 358 359 360 361