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 > CamSoft Products


CamSoft Products Discuss Camsoft PC based CNC controller products here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-18-2004, 11:54 PM
 
Join Date: Sep 2004
Location: Australia
Posts: 196
Darc is on a distinguished road
Anyone got any basic examples of a program using a subroutine/program?

I just need to know the correct format to enter.
Tweet this Post!Share on Facebook
Reply With Quote

  #2  
Old 10-19-2004, 12:04 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,823
HuFlungDung is on a distinguished road

Here's the logic I use, take it for what its worth. Its been so long since I wrote it, I forget how to interpret it

ISTHERE L;\198;\199
IF\198<1THEN LABEL2 STARTING LINE FOR SUBROUTINE NOT COMMANDED! :[CYCLEBUTT] :EXIT
ISTHERE R;\198;\199
IF\198=<1THENr=1 :LABEL2 NUMBER OF REPEATS "R" HAS DEFAULTED TO ONLY 1;14'defaults to one time through the subroutine
\36=\199 ISPLAY6 \36
GOSUB Ol;r 'subroutine must be lettered with an "O" firstly, lower case "L" is "O"subroutine number, repeated for "R" number of times
-----M98
LOADING \55
IF\55<1THENEXIT
REFRESH
'next code for incrementing the part counter as a repeat counter for subroutines
\36={\36-1}
DISPLAY6 \36
RETURN
-----M99
__________________
First you get good, then you get fast. Then grouchiness sets in.

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 10-19-2004, 02:01 AM
 
Join Date: Sep 2004
Location: Australia
Posts: 196
Darc is on a distinguished road

Well I gotta say that's way over my head.
I was hoping like a fanuc ar a fagor where you can have a subroutine inside a normal program, I think I'm a bit set in my ways with subroutines.
On our Fagor lathe you enter G22 N06.4 (G22 call the subroutine No. 06 and repeats it 4 times) and a bit lower in the program have G20 (start of sub routine) and at the bottom G24 (end of subroutine).
Tweet this Post!Share on Facebook
Reply With Quote

  #4  
Old 10-19-2004, 05:27 AM
Gold Member
 
Join Date: Sep 2003
Location: USA
Posts: 529
HillBilly is on a distinguished road

*
N0001 G90 G80 G40
N0005 M6T1
N0010 G43 H1 Z1.0
N0015 S500 M3
N0020 G00 X0 Y0
N0030 M98 P1010 L10
N0130 G93 M30

N1010 G01 Z-0.5 F25
N1020 X2
N1030 Y2
N1040 X0
N1050 Y0
N1060 G0 Z1
N1070 X3
N1080 G92 X0 Y0
N1160 M99

Mill example.
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 10-19-2004, 07:36 AM
 
Join Date: May 2004
Location: United States
Posts: 455
JRoque is on a distinguished road

Hey,

This is the simplified version. There are other options you can research later on.

1. Start by entering the "M98" command, followed by "P" and a label number and then "L" and the number of loops you want to repeat.

ie: M98 P1234 L5

This says that you want to run Program 1234, 5 times

2. On the subroutine, start by entering "O" followed by the label number

ie: O1234

3. When you're done with the subroutine, return to the main program by entering "M99"

4. Tell the main program to stop at the end so it doesn't run the subroutine again.

ie: M2 or M30

Here's how it all looks together

.....
.....regular program
.....
M98 P1234 L5 (go to sub labeled 1234 and loop 5 times)
.....
.....more regular program
.....
M30 (end of main program, don't execute beyond here)


O1234 (start of sub)
....
.... do something
....
M99 (return)

L8er,
Julio
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6  
Old 10-19-2004, 11:12 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,823
HuFlungDung is on a distinguished road

In CAmsoft, you can set the function up to emulate any controller synatax you like. But, you have to have some logic in M98 and M99 or calling them won't do anything.
__________________
First you get good, then you get fast. Then grouchiness sets in.

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 10-19-2004, 11:58 AM
 
Join Date: Sep 2004
Location: USA
Posts: 77
Swami is on a distinguished road

I do my loops using M98 like you showed.

One thing I would love to do, but havne't figured out, is how to call a subroutine from WITHIN a subroutine. It just doesn't work on CutViewer anyway. Not sure if it works on Mach2 or not.

Is this disallowed?

Swami
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 10-19-2004, 12:51 PM
 
Join Date: Apr 2003
Location: United States
Posts: 267
camsoft is on a distinguished road

Hello people,

Some new faces we see.

We believe we could help on this one and set a precedent to show you how to help yourself, regarding this topic as well as others.

Perhaps the best two pieces of advice to handle any topic are:

(1) In almost every question posed here in CNCZONE the answer is that you can have it any way you want. There is no single way to handle subroutines or almost any question posed for any topic about CamSoft, at least the CNC Professional version. Every one posting their methods for M98,M99 are correct. Simply because it depends on how the system logic is set up by the installer in the G&M code tables. For example, an installer may just not want to bother and use the default industry standard G&M code set, which includes M98,M99 logic already or they can opt to rearrange things to meet their customers needs by customizing the logic for any G and M code. Some customers want backwards compatibility to older formats. Sometimes we think we have seen everything and can't be surprised, but a make or break request comes in time to time that makes us and our dealers thankful for the flexibility of CNC Professional.


(2) To get the fastest answers use the Search for Solutions button on CNCSETUP. Here you can search for answer like a web-browser, through 130+ megabytes of electronic text, photos and charts even movies. A search on M98 pops up 21 occurrences of page documentation for this topic.

Some information you'll find is:

The logic in M98 can be set up for the letters O, P or N or any letter to call the subroutine. Also the number of loops are usually denoted as L but can be P in some cases. There are even pure jumps to other line numbers instead of subroutines that return.

QUESTION 169
Can we call a Macro from within another Macro?

QUESTION 209
How do we call and loop subroutines in the G code program?

Below are some examples:
(Call a simple subroutine and repeat the subroutine 3 times.)
N1 G0 X0 Y0 Z0
N2 M98 P1234 L3
N3 M30

O1234
N4 G1 Z-.5 F25
N5 G0 Z.1
N6 M99

(Use a subroutine to loop the entire program 100 times.)
N1 M98 P1234 L100
N2 M30

O1234
N4 G0 X0 Y0 Z0
N5 G1 Z-.5 F25
N6 G0 Z.1
N7 M99

(Nested Subroutines)
N1 G0 X0 Y0 Z0
N2 M98 P1234 L1
N3 M30

O1234
N4 G0 X1 Y1 Z1
N5 M98 P5678 L1
N6 M99

O5678
N7 G1 Z-.5 F25
N8 G0 Z.1
N9 M99

Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com
__________________
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 10-21-2004, 12:08 AM
 
Join Date: Sep 2004
Location: Australia
Posts: 196
Darc is on a distinguished road

Got a couple more question for you guys (surprise surprise).
What's the difference between a stepper motor and an active low pulse stepper motor? (how do I tell which I have?)
Also after I home the machine then move the axes to where I want the home light stays on, what's the best way to ensure when I move from machine 0;0;0;0;0;0 the light will go out?
Tweet this Post!Share on Facebook
Reply With Quote

  #10  
Old 10-21-2004, 08:16 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,823
HuFlungDung is on a distinguished road

I haven't seen your logic of course, but you'll simply have to write logic to turn the light off when the sequence is completed. I'm assuming you are talking about a Camsoft gui "light".
__________________
First you get good, then you get fast. Then grouchiness sets in.

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11  
Old 10-21-2004, 08:27 AM
Gold Member
 
Join Date: Sep 2003
Location: USA
Posts: 529
HillBilly is on a distinguished road

Active high or low stepper is drive dependant (high=motor winding on or low=motor winding on.).

If your home is actually on the switch you can put the logic in the LIMITS.FIL.
Anytime a limit or home switch is triggered the LIMITS.FIL is ran.

If your home is not on the switch you can use ISTHERE logic in the commands G00, G01, JOG.FIL, ect...

Darek
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 10-09-2005, 12:45 AM
 
Join Date: Oct 2005
Location: USA
Posts: 19
truline is on a distinguished road

Thanks this helped me alot with my MillMaster Pro program!

-truline
Tweet this Post!Share on Facebook
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
Learning to Program CNC Turning Center Farmer G-Code Programing 13 09-12-2005 01:03 AM
parametric programming Karl_T CamSoft Products 21 05-24-2005 03:58 PM
How to cut multiple parts (loop a program) Bird_E Mach Software (ArtSoft software) 6 05-13-2005 04:16 PM
A few honest questions HuFlungDung CamSoft Products 8 06-15-2004 07:24 PM
G-Code Cutter Comp Program jcc3inc DIY-CNC Router Table Machines 0 02-27-2004 11:29 AM




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