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! > MetalWorking Machines > Haas Mills


Haas Mills Discuss Haas machinery here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 03-11-2008, 10:38 PM
 
Join Date: Nov 2006
Location: USA
Posts: 263
bob1112 is on a distinguished road
M97, M98 subroutine call. How to use

We need to used subs with our Haas and never done it with the Haas. Can someone walk me through it or post an example? I am not sure if it is easier to use an M98 and call from a separate list or just use M97 within the program. We basically need to program 2 ops on one center and then repeat it at three different XY locations. I am thinking the M97 would be easier but not sure how this needs to look to ensure proper retract and rapids.

I figure we would need to run the first op and then write an M97 with the remaining centers, then allow the M6, and repeat the the process for op 2. Can someone help here? I understand the Haas is slightly different than the Fanuc.
Reply With Quote

  #2   Ban this user!
Old 03-12-2008, 01:13 AM
 
Join Date: Jul 2005
Location: POLAND
Age: 33
Posts: 340
pit202 is on a distinguished road

Try something like this :

G55 G90 ( first location )
M97 P10
G56 ( second location )
M97 P10
(etc)
M30

N10 G0 Z30
G84 ......
.....
G80
G0 Z30
M99
Reply With Quote

  #3   Ban this user!
Old 03-12-2008, 09:06 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

I do this all the time on Haas with numerous work locations and numerous tools.

The procedure I developed which is the most adaptable to changing the number of work zeroes is to have the main program consist of nothing but the Work Zero specifications with M97 calls to subroutines for each tool.

Every command for a particular tool is in the subroutine and the tool completes all its operations at one location then the subroutine is called again for the next location. This means that the first time a subroutine is called the tool change occurs but the second and later times the tool change is not needed. This is okay with a Haas because they have a setting 'skip same tool change' so it does not waste time taking the tool out and putting it back in. Some tools have more then one subroutine in some programs because they do different operations in different work zeroes.

Here is a large program with many work zeroes on a rotating fixture. The main program sets the work zero and rotates the fixture to the correct position then calls the subroutine.

http://www.cnczone.com/forums/attach...5&d=1201789958

This program is in this thread;

http://www.cnczone.com/forums/showthread.php?t=51582
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #4   Ban this user!
Old 03-12-2008, 09:13 AM
gar gar is offline
 
Join Date: Mar 2005
Location: USA
Posts: 1,498
gar is on a distinguished road

080312-0901 EST USA

viper6383:

The choice of internal vs external subroutines is dependent upon the purpose of the subroutine, except for G65.

If the subroutine is unique to the particular program it is called from, then make it internal. If many different programs might use the same subroutine, such as a tool change, then make it external.

G65 requires the subroutine to be external.

I would use G52 and a single G5x for multiple part locations rather than multiple G5xs, but that only becomes most important with a large number of parts, like 10 or more.

.
Reply With Quote

  #5   Ban this user!
Old 03-12-2008, 09:22 AM
 
Join Date: Nov 2006
Location: USA
Posts: 263
bob1112 is on a distinguished road

I guess my biggest question right now is where to put the sub call? How does it know to retract? Seems simple but gotta learn the basics of this. Out Dynapath is much easier for this stuff.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 03-12-2008, 09:37 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

Originally Posted by viper6383 View Post
I guess my biggest question right now is where to put the sub call? How does it know to retract? Seems simple but gotta learn the basics of this. Out Dynapath is much easier for this stuff.
"How does it know to retract?"

Do you mean the tool retracting?

Here is a section out of my program:

N49 (SELECT WORK ZEROES)
N50 G53 Z0.
N50 G54 X0. Y0. A0. M97 P11000
N51 / G55 X0. Y0. A0. M97 P11000
N52 G54 X0. Y0. A0. M97 P12000
N53 / G55 X0. Y0. A0. M97 P12000

Line N50 G53 Z0. moves the tool up to the tool change position so it is clear of the fixture. Then it moves to work zero G54 and rotates the fixture to zero degrees and calls subroutine P11000.

At the bottom of this subroutine there is this line; N11038 G53 Z0. M99 so before returning from the subroutine and selecting G55 on line N51 the tool once more retracts to the tool change position.

This way you always know the tool is clear when moving to a new location.

G53 Z0. does the same as G91 G28 Z0. which is maybe what you have used. I like to use G53 because then I cannot accidently leave incrmental mode on.

As gar mentions another way of doing the work zeroes is to use G52. On programs a write now I do use G52 but I started with G54, G55, etc. I think it is better to stick with the familiar work zeroes until you have evtrything straight.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #7   Ban this user!
Old 03-12-2008, 10:52 AM
 
Join Date: Nov 2006
Location: USA
Posts: 263
bob1112 is on a distinguished road

I notice you are using M97 internal command. Where is the P11000, 12000 calls? Do they go at the bottom of the program? Are they even in the program? Basically, with our Dynapath, you simply add one code and a first and last line to repeat, and at what locations. I am trying to shift my brain over with this way of thinking. Seems the same but different.

I guess what I am asking is if I have an op, can I put an M97 after the op tool retract and call more centers? Does the control automatically ignore the start up commands and go right to work? I am trying to figure out where to insert sub calls and how to figure out what lines will get repeated if that makes any sense.
Reply With Quote

  #8   Ban this user!
Old 03-12-2008, 11:34 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

Originally Posted by viper6383 View Post
I notice you are using M97 internal command. Where is the P11000, 12000 calls? Do they go at the bottom of the program? Are they even in the program? ...
Open the program I linked you to, everything is in one program.

All the work zero stuff and the M97 P11000, etc is in the top of the program above the M30. All the subroutines are below. I call the part from the program number down to the M30 my 'main' program.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #9   Ban this user!
Old 03-12-2008, 12:47 PM
gar gar is offline
 
Join Date: Mar 2005
Location: USA
Posts: 1,498
gar is on a distinguished road

080312-1216 EST USA

viper6383:

I believe you have no experience with assembly language computer programming. On that assumption here are some basic concepts:

A subroutine is a block of code that can be called from somewhere and upon completition of the subroutine will return to the next instruction following the instruction that called the subroutine.

Thus, there needs to be an address label that defines where the subroutine is located. Then within the subroutine there has to be an instruction that says to return. In assembler it is usually called RET. In HAAS it is an M99 instruction. Note: HAAS and Fanuc use M99 in more than one way. So if within a group of program instructions that you have choosen to use as a subroutine, then as you progress thru the instructions when an M99 is encountered this will cause a return from the subroutine to the calling program and the instruction following the calling instruction. Note: another subroutine could be the calling program (in other words subroutines can be nested). If you did not enter the subroutine by a calling line of code, then M99 will will cause some other action. A GOTO to the line number of the subroutine will not cause the code to be treated as a subroutine.

I can put a subroutine almost anywhere I want within an O-numbered program, but it will be usual to do as Geof has indicated and put all your subroutines after your main program delimited by the M30. I will not go into how you do tricky things with subroutines.

In HAAS an internal subroutine is addressed by the line number of the first line of code in the subroutine.

Within a subroutine you can do jumps (GOTO), but do not jump outside the subroutine.

If you do not use G65, then to pass parameters to a subroutine you must load the values into suitable #-variables, such as #500, etc.

.
Reply With Quote

  #10   Ban this user!
Old 03-12-2008, 12:52 PM
 
Join Date: Nov 2006
Location: USA
Posts: 263
bob1112 is on a distinguished road

To be honest, you are way over my head with this. Looks like you are using programmable offsets, 4th axis, and a little too much for me to catch the layout. I am also a bit confused on the "L" count. As I understand it, that would force the exact same operation over and over? Or does that just confirm how many centers it will execute? I have included a basic drill op and added my sub call in red. I am sure I am off base so please critique my work.

%
O100
(SUB CALL TEST1)
()
N100G20
N110G0G17G40G49G80G90
(1/8 DRILL TOOL 1st op)
N120T2M6
N130G0G90G110X0.Y0.S1000M3
N140G43H2Z1.
N150G98G81Z-.5R.2F20. L0
N155 M97 P1000
N160G80
N170G49
N180G91G28Z0.
N190G28Y0.
N200M30
%


N1000
X1, Y0
X2, Y0
X3, Y0
M99

Last edited by bob1112; 03-12-2008 at 01:35 PM.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 03-12-2008, 02:18 PM
gar gar is offline
 
Join Date: Mar 2005
Location: USA
Posts: 1,498
gar is on a distinguished road

080312-1414 EST USA

viper6383:

I do not have time to go over your code at the moment.

But one quick observation. The % following the M30 must be moved to the end of the file. The %s have nothing to do with the program code. The first % tells HAAS to start processing the data that follows. The second % terminates loading. The file as currently written will never load load the subroutine.

(edit) You can single step your program and see what happens at each step in either graphics or machine mode. (end edit)

.
Reply With Quote

  #12   Ban this user!
Old 03-12-2008, 07:41 PM
 
Join Date: Nov 2006
Location: USA
Posts: 263
bob1112 is on a distinguished road

Yeah, I also had some parts show up so had to pull off of that. I do remember that my sub call at the bottom was not pulling in so you caught that one. I will keep jacking with it. Thanks for the pointer
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
Example of a Subroutine? donl517 Fadal 14 06-27-2007 10:05 AM
Help with calling a subroutine hindocarina Mach Mill 2 02-11-2007 09:32 PM
trying to call a subroutine hindocarina G-Code Programing 4 02-11-2007 08:01 PM
Need help with a subroutine formulae... Darc G-Code Programing 2 01-09-2006 05:05 PM
Need help with subroutine 2_jammer General CAM Discussion 1 01-17-2005 10:46 PM




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