![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Haas Mills Discuss Haas machinery here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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. |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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. . |
|
#6
| |||
| |||
| 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. |
|
#7
| |||
| |||
| 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. |
|
#8
| |||
| |||
| 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. |
|
#9
| |||
| |||
| 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. . |
|
#10
| |||
| |||
| 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. |
| Sponsored Links |
|
#11
| |||
| |||
| 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) . |
![]() |
| 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 |
| 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 |