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 06-05-2008, 01:35 PM
 
Join Date: Sep 2007
Location: US
Posts: 95
LockTech is on a distinguished road
whole G-Code REPEAT command ??

seems simple but have been searching everywhere to no avail...

is the a g-code command that simply restarts proccessing at the beginning of the code?

or just repeat the code ?
Reply With Quote

  #2   Ban this user!
Old 06-05-2008, 02:06 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,564
Geof will become famous soon enough

I think what you can use depends on your controller.

Sometimes if you end a program with M99 the controller will go back and start at the top, and do this endlessly; some controllers will give an alarm telling you it is an endless loop.

The best way in my opinion is just put the code to be repeated in a subroutine and then use an L count in the subroutine call;

etc
etc
M97 P1000 L5
etc
etc
M30
N1000 Code being repeated
etc
etc
M99

You can simply repeat the section of code. I program on Haas and it is so easy to duplicate blocks of code I will do this when I am feeling too lazy to set up the subroutine format. But if you simply repeat the block of code many times then want to edit it you have many places to edit; with the subroutine approach you edit at one place.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

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

Since G codes don't have anything to do with "tape function", probably you would need an M code, like M99. You might be able to use a WHILE/DO loop, or an IF/GOTO or a straight GOTO statement. The M98 subprogram call would work for L times, but it wouldn't be an endless loop. The only G code might be a G65 macro call that would refer to a program that had M99P10 at the end (where 10 is the line number just before that macro call). Then you'd also be stuck in a loop. Of course it does depend on which control you are using.
Reply With Quote

  #4   Ban this user!
Old 06-05-2008, 03:26 PM
 
Join Date: Jul 2007
Location: USA
Posts: 195
JROM is on a distinguished road

M30 is rewind back to start of program. But you have to hit the big green button again to start the program again.
__________________
Be carefull what you wish for, you might get it.
Reply With Quote

  #5   Ban this user!
Old 06-05-2008, 04:40 PM
 
Join Date: Sep 2007
Location: US
Posts: 95
LockTech is on a distinguished road

Thx for the info....Beege the M98 sounds simple since I dont actually need it to be endless. so it would just be (M98 #) where # = numer of repeats?

btw, the controller is a xylotex and yes Geof its pulling an alarm with M99
Reply With Quote

Sponsored Links
  #6  
Old 06-05-2008, 11:29 PM
Gold Member
 
Join Date: Oct 2005
Location: USA
Posts: 663
Caprirs is on a distinguished road

Typically, the M98 calls the subprogram/subroutine.

On my Mitsubishi controls, the format is:

M98 Pppp Hhhh Ll

ppp=external subprogram number (omit if subroutine is at end of current program)
hhh= line number of the subroutine
l= number of times to repeat

The subroutine would start at line hhh and the signal to finish and return the original block is M99.

Some machines have proprietary loop/repeat codes.
Reply With Quote

  #7  
Old 06-05-2008, 11:33 PM
Gold Member
 
Join Date: Oct 2005
Location: USA
Posts: 663
Caprirs is on a distinguished road

Xylotex only refers to the motors/drives apparently? What software is controlling all this on the PC?
Reply With Quote

  #8   Ban this user!
Old 06-06-2008, 07:31 AM
 
Join Date: Sep 2007
Location: US
Posts: 95
LockTech is on a distinguished road

Capris, using Mach3
Reply With Quote

  #9  
Old 06-06-2008, 09:11 AM
Gold Member
 
Join Date: Oct 2005
Location: USA
Posts: 663
Caprirs is on a distinguished road

According to the Mach3 website, Geof's code above is close except he has M97 instead of M98 and instead of using "N1000" it should be O1000. Note that O1000 starts with the letter "O", not the numeral zero.

Plagarizing Geof:

etc
etc
M98 P1000 L5
etc
etc
M30
O1000 Code being repeated
etc
etc
M99


According to the Mach3 website, line O1000 cannot contain anything other than a comment (sub 1000, for example).

I get all that from http://www.machsupport.com/docs/Mach3Mill_1.84.pdf looking at page 138 of 157 of the PDF file (10-34 in Mach3 pages).
Reply With Quote

  #10   Ban this user!
Old 06-06-2008, 09:29 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,564
Geof will become famous soon enough

Originally Posted by Caprirs View Post
....Plagarizing Geof:...
Imitation; the most sincere form of flattery. Thank you.

The M97/M98 thing is why I have learnt to put the comment about it depending on your controller.

I program on Haas and use M97 which is an internal subroutine call, M98 jumps you out to a different program. Does Mach use M98 as an internal call requiring the M99 return?
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

Sponsored Links
  #11  
Old 06-06-2008, 11:26 AM
Gold Member
 
Join Date: Oct 2005
Location: USA
Posts: 663
Caprirs is on a distinguished road

Originally Posted by Geof View Post
Imitation; the most sincere form of flattery. Thank you.

The M97/M98 thing is why I have learnt to put the comment about it depending on your controller.

I program on Haas and use M97 which is an internal subroutine call, M98 jumps you out to a different program. Does Mach use M98 as an internal call requiring the M99 return?
Is stealing really the same as imitation?

On my Mitsubishi machines, there is no M97. M98 is the only available command.

M98 P H L I J

P = external program number. If no P is specified, the control searches within the current program.

H = line number. I don't know why Mits uses H instead of N. If going to an external program P, no H is required.

L = repeat. Number of times to repeat the sub. If no L specified, the sub is executed once.

I, J = allow for rotation of the sub as it is repeated. For example, making a gear involves the code for single tooth that is repeated enough times to rotate the 360 degrees.
Reply With Quote

  #12   Ban this user!
Old 06-06-2008, 12:14 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,564
Geof will become famous soon enough

Originally Posted by Caprirs View Post
Is stealing really the same as imitation? .....
Go on, cut me some slack

That rotation feature looks handy. Haas does it a different way.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
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
g code for repeat the previous move woffler G-Code Programing 6 03-26-2008 10:07 PM
How Do I Repeat? TZ250 Dolphin CADCAM 2 03-04-2008 05:11 AM
Repeat command on TL-1? Haeusser Haas Lathes 4 07-31-2007 05:31 PM
Need help on G75.1 pattern repeat wayne mitchell G-Code Programing 1 03-16-2005 02:49 PM
Repeat g-code with y offset tpaulson G-Code Programing 19 11-29-2004 01:36 PM




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