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 07-30-2010, 07:47 AM
 
Join Date: Jul 2010
Location: Netherlands
Posts: 15
Dick1951 is on a distinguished road
Program Subroutines

How can I call a subprogram,
How to use Mode In/Mode Out?
Who can help me out?
Reply With Quote

  #2   Ban this user!
Old 07-30-2010, 01:00 PM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

That’s pretty vague.

What kind of control are you using? What kind of machine are you using? What do you mean by mode in/mode out?

On most machines a subroutine is called with a M98 followed by the program number you want to call and then an M99 to end the subroutine.

Example:
O0001(main program)

M98P1000
M30

O1000(subprogram)

M99

Program 1 will call program 1000 at the M98 line and when program 1000 is finished and reads the M99 it will end and return to the M30 line of program 1.

Stevo
Reply With Quote

  #3   Ban this user!
Old 07-30-2010, 01:17 PM
 
Join Date: Apr 2008
Location: USA
Posts: 49
guru is on a distinguished road

Okuma use Mode In/Mode Out.

Try a simple call

CALL Oxxx
Reply With Quote

  #4   Ban this user!
Old 07-30-2010, 04:20 PM
 
Join Date: Sep 2009
Location: USA
Posts: 74
jvangelder is on a distinguished road

If you want to have the sub run more than once you can use M98 P1000 LXX where the XX is the number of times you want to loop
Reply With Quote

  #5   Ban this user!
Old 07-31-2010, 03:57 AM
 
Join Date: Jul 2010
Location: Netherlands
Posts: 15
Dick1951 is on a distinguished road

What kind of control are you using? What kind of machine are you using? What do you mean by mode in/mode out?

I am using the Okuma LB15 1986 with control: OSP 5000L.
MODE IN/MODE OUT is a subroutine and is a instruction to jump from a main prog to a subroutine.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-10-2010, 12:04 AM
broby's Avatar  
Join Date: Apr 2006
Location: Australia
Age: 48
Posts: 578
broby is on a distinguished road

Originally Posted by Dick1951 View Post
What kind of control are you using? What kind of machine are you using? What do you mean by mode in/mode out?

I am using the Okuma LB15 1986 with control: OSP 5000L.
MODE IN/MODE OUT is a subroutine and is a instruction to jump from a main prog to a subroutine.
To use MODIN and MODOUT you have to understand first how to call a subprogram using standard CALL statements.

For example, maybe you are cutting a special shaped groove on the OD of a part...
Name the Subprogram, Following these rules:
Must start with the letter O
Use up to 4 Alphanumeric characters for the "Name" of the sub program.
i.e. can use Numbers or Letters, but if you start with a number, you must use all numbers, if you start with a Letter, you can use letters and numbers.
Valid examples are:
O1234
O1
O0001
OPRG
OPRG1

Invalid examples:
1234 <- no starting letter O
O12345 <- too many characters after the "O"
O123A <- started with a number and then used letters no no.

Your subroutine must end with the letters "RTS" on the last line.

i.e. A valid subroutine could follow this sample:
OSUB1
...
..
.
BLAH
BLAH appropriate machine here
BLAH
.
..
...
RTS


Using a subroutine from within the main program is as follows:
N100 G0 X300 Z500
N102 M3 S1200
N104 M8
N106 T010101
N108 X50 Z50 (POSITION AT START POINT FOR SUB ROUTINE)
N110 CALL OSUB1 (CALL THE ROUTINE...)
N112 G0 Z40 (MOVE TO POSITION FOR NEXT GROOVE)
N114 CALL OSUB1 (MACHINE GROOVE)
N116 G0 Z30 (MOVE TO POSITION FOR NEXT GROOVE)
N118 CALL OSUB1 (MACHINE GROOVE)
N120 G0 X300 Z500 (GO HOME)
N122 M5 M9
N124 M2
OSUB1 (SUB TO DO SOMETHING... I.E. PLUNGE A GROOVE)
N1000 G1 X40 F0.15
N1002 G4 F0.25
N1004 G0 X50
RTS


In that example, I was machining a groove down to 40mm diameter, at any given position on Z axis.
First I move the machine into the position I wanted the groove at, and then I called the subroutine to machine the groove.
Obviously, this is a very simple example of what can be done, but it is for demo purposes only.

Now, using the MODIN/MODOUT approach, the above program can be written as follows:


N100 G0 X300 Z500
N102 M3 S1200
N104 M8
N106 T010101
N108 X50 Z50 (POSITION AT START POINT FOR SUB ROUTINE)
N110 MODIN OSUB1 (TELL THE MACHINE THAT FOR EACH MOVE DESIGNATED, BETWEEN THIS LINE AND MODOUT, YOU WANT SUB ROUTINE OSUB1 CALLED)
N112 Z40 (MOVE TO POSITION FOR NEXT GROOVE)
N116 Z30 (MOVE TO POSITION FOR NEXT GROOVE)
N118 MODOUT (NO MORE SUB CALLS ACTED UPON)
N120 G0 X300 Z500 (GO HOME)
N122 M5 M9
N124 M2
OSUB1 (SUB TO DO SOMETHING... I.E. PLUNGE A GROOVE)
N1000 G1 X40 F0.15
N1002 G4 F0.25
N1004 G0 X50
RTS

A simple analogy would be to use an example of a drilling cycle on a mill:
1st specify the drilling cycle pattern...
2nd specify where you want the holes
3rd cancel the drilling cycle

The 1st part is the line N110 in the above example
the lines N112 and N116 in the above example are the 2nd step
the 3rd step, cancelling the routine is done on line N118

Using M98 Pxxxx is FANUC talk... NOT understood by an Okuma
Nor is the M99 understood by an Okuma in this manner.
The equivalent to the M99 on an Okuma is the RTS (ReTurn from Subroutine).
The equivalent of the M98 Pxxxx is the CALL Oxxxx statement.

Hope this helps
Brian.

Last edited by broby; 08-11-2010 at 07:56 AM.
Reply With Quote

  #7   Ban this user!
Old 09-11-2010, 10:44 AM
 
Join Date: Jul 2010
Location: Netherlands
Posts: 15
Dick1951 is on a distinguished road
sub program/modin-modout OKUMA

Hi Broby

Thanks for the post.
I am sorry for my enlish.
I'll try to explain what I tried.
I did write the follow program:
N100 G97 S1000 M04
N101 G00 X75 Z10 T010101
N102 X50 Z-10
N103 Call OSUB1
N104 Z-30
N105 Call OSUB1
N106 M05
N107 G00 X500 Z600
N108 M02
Osub1
N1000 G00 X40
N1001 G01 X30 F0.1
N1002 G00 X50
RTS
When the engine is reading this program,the error 2511(the file is not found) follows.
May be this manner is an optie,who's buying to completing the engine?
I am a machine operator and i like to learning this.
Thanks for your supporting.

Dick
Reply With Quote

  #8   Ban this user!
Old 09-12-2010, 07:25 AM
broby's Avatar  
Join Date: Apr 2006
Location: Australia
Age: 48
Posts: 578
broby is on a distinguished road

Originally Posted by Dick1951 View Post
Hi Broby

Thanks for the post.
I am sorry for my enlish.
I'll try to explain what I tried.
I did write the follow program:
N100 G97 S1000 M04
N101 G00 X75 Z10 T010101
N102 X50 Z-10
N103 Call OSUB1
N104 Z-30
N105 Call OSUB1
N106 M05
N107 G00 X500 Z600
N108 M02
Osub1
N1000 G00 X40
N1001 G01 X30 F0.1
N1002 G00 X50
RTS
When the engine is reading this program,the error 2511(the file is not found) follows.
May be this manner is an optie,who's buying to completing the engine?
I am a machine operator and i like to learning this.
Thanks for your supporting.

Dick
About the only thing I can see wrong here is that you have used lower case letters in your program.
The earlier controls (like yours) can NOT use lower case letters.
So first try changing all lowercase letters to UPPERCASE then once that is working, try the following change...
To do this same routine with MODIN/MODOUT this is how I would change your program...

N100 G97 S1000 M04
N101 G00 X75 Z10 T010101
N102 X50 Z-10
N103 MODIN OSUB1
N104 Z-10
N105 Z-30
N106 MODOUT
N107 M05
N108 G00 X500 Z600
N109 M02
OSUB1
N1000 G00 X40
N1001 G01 X30 F0.1
N1002 G00 X50
RTS

Hope this is helpful?
Cheers
Brian.
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
MSC-516 Will not load subroutines BluegrassPicker Mori Mills 5 06-16-2010 05:56 AM
Need Help!- with subroutines Thad Swarfburn G-Code Programing 0 06-24-2009 08:37 PM
EMC and Subroutines? watchman LinuxCNC (formerly EMC2) 9 06-17-2007 02:30 PM
Oi subroutines help mishikwest Fanuc 1 08-01-2006 05:17 PM
Fanuc 15m Subroutines BROCD Fanuc 11 02-27-2006 07:04 AM




All times are GMT -5. The time now is 07:46 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