![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Fanuc Discuss Fanuc controllers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hello all, I am running a Takisawa EX-110 lathe with a Fanuc 21i-T control. This is my program: :0100 M98P0101 M98P0102 M98P0103 M30 What I want to do is loop through this program a specific number of times, (say 35 times) and then stop. I know you can use macros to create loops and logic and such but I have never used them. Could somebody help me with this problem? Thanks a lot! |
|
#2
| ||||
| ||||
You could write a short program: :O1000 M98P0100L#500 M30 You'd have to end your original program with an M99 instead of an M30. Then, enter the number of repetitions into your Macro Variable table at #500. Not sure about the format for repetition values in the M98 line. Some controls are different there. Also, there's a limit to the depth of nested programs, so if you have subs in your subs, this might be problematic. |
|
#4
| |||
| |||
| ok, I found my variables. I would like to keep it all in one program if possible. If I were programming my computer, I would do something like this: :0100 for(int i = 0; i < =35; i++) { // call program 101 // call program 102 // call program 103 }; M30 Can I do something similar on the lathe? |
|
#5
| ||||
| ||||
| #500=1 WHILE[[#500]LE[35.]]DO1 M98P101 M98P102 M98P103 #1=#1-1 END1 Just change the 35 to however many repeats you need. Set #500 in program. Just make sure your sub programs don't use #500 or WHILE loops... DP |
| Sponsored Links |
|
#8
| |||
| |||
|
|
#9
| ||||
| ||||
| Aaaaah yes. I appear to have changed my mind twice in my original post... Change it to #500=#500+1 and all will be well. Made myself look a right clown there eh? I changed from local macros #1-#33 to common macros #500+ as I wasn't sure if the locals would be affected by jumping in and out of main program. More often than not I spend longer debugging my programs than coming up with the original concept.... DP |
|
#10
| ||||
| ||||
| :O0100 #500=#500+1 IF [#500 GT 35] GOTO N999 M98P101 M98P102 M98P103 M99 N999M30 |
| Sponsored Links |
|
#11
| ||||
| ||||
| Damn, couldn't find a single mistake in your post, am I the only one with poor brain/finger co-ordination ('co-operation' may be the right word in my case)?... ![]() Of course the GOTO method would also be the best way to go if you wanted to eliminate the need for sub programs. DP |
|
#12
| ||||
| ||||
| Hello. Christian is right with his method. The only thing is though, 500 variables are not cleared until they are physically changed. Therefore use 100 variables. :0100 WHILE[#100LE35]DO1 M98P0101 M98P0102 M98P0103 #100=#100+1 END1 M30 Fanuc Mate |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Open Loop to Closed Loop Stepper Conversion | beamhome | Stepper Motors and Drives | 9 | 05-24-2012 02:46 AM |
| Newbie- CNC conversion typically open loop or closed loop? | foobar42 | Benchtop Machines | 8 | 10-29-2009 07:21 PM |
| question on closed loop vs open loop (servo systems) | boonie | Servo Motors and Drives | 20 | 11-09-2007 12:30 PM |
| Closed loop vs. open loop | pelesl | Benchtop Machines | 10 | 04-06-2007 04:56 PM |
| Lathe conversion - open loop vs closed loop | bhowden | General Metal Working Machines | 7 | 03-21-2006 03:56 PM |