![]() | |
| 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
| |||
| |||
| I just got done answering another post about the TM-1, and had seen macros mentioned. I know we have the macros on our mill, and others I have run in the past. I've never used them to my knowledge, but now wonder if they could be useful. So I know there is probably somebody who may fall out out of their chair laughing when they read my question below, but I thought I would ask anyway. I figure it never hurts to learn more. Here goes... If we program at a PC, then how are macros useful in what we do? Most of the time of we have complex things or multiple parts we just set them up on the PC screen and then do all of the work there. Clarification on macros could help us in the future. I've read parts of the manual, never really understood the macro part. |
|
#2
| |||
| |||
| 070721-1336 EST USA CJH: The MACROS option on CNC machines is merely an extension to the basic G & M code language. This is not to be confused with a computer program macro. Many things you can do when you have the MACROS option. From a prior post of mine on CNCZONE "You can do logic, math, and trig functions. You can easily pass parameters to subroutines. DPRNT is available which allows you to output data to the COM 1 serial port. You can create counters for special functions. You can easily do step and repeat functions, even with varying increments. You can write a program that will step and repeat for a variable number of steps, and do it efficiently without a lot of tool changes. You can access timers and operate on the values." You can call an external subroutine, G65, and pass parameters to the routine. Unfortunately this capability does not exist for internal subroutines. Another prior post "Following is a thread I started on a Tool Change Macro: A sample tool change macro. And at some time you might want to study this thread: Hass VF-1 work coordinate problems " The way you make a counter is: Select a suitable non-volatile memory address such as #500 for your counter register, then whenever you want to increment the counter execute this instruction: #500 = #500 + 1 or maybe #500 = #500 + 1.0 The counter can be initialized to any value you want with: #500 = desired initial counter value, usually 0. To make a down counter use: #500 = #500 - 1 Or you can count by someting other than 1: #500 = #500 + 1.75 To convert from polar to rectangular coordinates within the first quadrant #100 = numeric value of radius #101 = angle of point #500 = #100 cos [#101] (....... the X-axis coordinate) #501 = #100 sin [#101] (........ the Y-axis coordinate) Study the MACROS section of the HAAS manual. If in Google you insert the following search string you will find much discussion on MACROS site:cnczone.com "gar" G65 . Last edited by gar; 07-21-2007 at 04:20 PM. |
|
#4
| |||
| |||
| I think the direct answer to your question which I took the liberty of making bold is...macros are mostly superfluous. I put mostly because gar has some examples that I think cannot be replicated by doing things on the PC. My take on macros is that by and large they are a hangover from the days when memory was in short supply in CNC machines. When you read the manual explanation for macros one thing that is mentioned is their use in "simplifying" programming for 'families of parts', parts which are in many ways similar but have one or a few dimensions different. If you have two parts that only differ in one or a few dimensions and you program them separately the programs are practically identical except for one or a few lines. So if you can write a program which allows you to easily insert these values that differ into any easy to find location in the program before running it you can save memory; you don't have to store both versions you store one with just a few extra lines. The location that you enter the differing dimensions is the macro variables. These days available memory is rarely a limiting factor in CNC machines; particularly when hand coding. In addition Haas machines have such an easy to use editor it is dead simple to copy a program, find the dimension that differs in a different part in the family and change it; it is a simple find-and-replace operation. My company makes numerous parts that are in families; in some case differing only in that one has metric threads and another imperial threads; we could do things with macros but we simply have two programs one for each thread type. This is in fact easier than using macros because the operator simply brings up the appropriate program and does not even need to worry about the variables. I also think macros are a hangover from the days when compound curves that were not constant radii were difficult to do partly because large programs could not be stored and partly because there was no way to easily convert coordinates describing the curve into G code. Performing calculations in real time within a macro made it possible to generate complex curves on the machine while it was actually doing the curve; a prerequisite of course is that it must be possible to describe the curve with a mathematical function. When this is possible it is not difficult to generate the curve as a series of very short straight line moves by sequential calculations from any arbitrary starting point; only the next point exists at any one time and in the machine memory the current point overwrites the immediately preceding point. Not much memory is needed. CAD/CAM does precisely the same thing but in this case the multitudinous points making up the curve in the CAD depiction are converted into multi-thousands of lines of G code by the CAM requiring huge amounts of storage not previously available. As a 'not-so-side-comment' in the early days when the macro was running in the machine controller it would bog down the processor with the calculation load so the processor could not run the machine at a good speed. Early CNCs where in some ways limited more by their processor speed than by their mechanical capabilities; this as far I have have been able to discern turned around in the mid to late 1980's when they became limited more by the maximum servo power and speed. Now I think with modern brushless servos, and on some machines linear motors, once more the mechanical side is pushing the processor side. I have read articles in the past describing how complex shapes where generated 'off-machine' in (at that time big and fast) computers such as the PDP-11 and dripped into the machine processor line by line to speed up the running of the machine. These days CAM programs sometimes generate such huge amounts of G code that it overwhelms even the expanded machine memory and has to be dripped in. And when the data transfer speed is rate limiting the machine stutters and stalls which is entirely analogous to the early day processors bogging down with macro calculations. Which I think shows how things stay the same when they change. And that is my explanation for my 'macros are mostly superfluous' answer.
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
|
#5
| |||
| |||
| This is a program we use to end mill holes in round flanges. We use this for small lot jobs. G54 X/Y is always the center of the part. It uses WHILE/DO - END logic. I prefer this to the IF/THEN logic. I am posting this as an example of what you can do with Macro Programming % O3544 (MILL HOLES ON A B.C.) N30 (WRITTEN 07-24-2007 14:57:49) N40 (RETURNED 07-26-2007 11:03:07) N50 #602= 1.125 ( DIAMETER OF HOLES ) N60 #603= 18.0 ( BOLT CIRCLE OF HOLES ) N70 #604= 0.2 ( DEPTH OF EACH CUTTING PASS ) N80 #605= 3.0 ( NUMBER OF CUTTING PASSES ) N90 #601= 7.0 ( FEED RATE ) N100 #620= 3000.0 ( SPINDLE SPEED ) N110 #606= 0.5 ( DIAMETER OF END MILL ) N120 #621= 83.0 ( PERCENT OF END MILL DIA STEPOVER ) N130 #607= 16.0 ( NUMBER OF HOLES ) N140 #608= 11.25 ( STARTING ANGLE 3 O:CLOCK = ZERO ) N150 #609= 22.5 ( DEGREES BETWEEN HOLES ) N160 #610= 0.0 ( TOP OF PART IN 'Z' AXIS ) N170 #611= 2.0 ( CLAMP/FIXTURE 'Z' AXIS CLEARANCE PLANE ) ( END OF INPUTS ) N190 #604= [ #604 * -1 ] N200 #612= [ #602 / 2 ] N210 #613= [ #603 / 2 ] N220 #616= [ #606 / 2 ] N230 #617= [ #606 * [ #621 / 100.0 ] ] N240 G17 G54 G90 N250 G40 G49 G80 ( TOOL #01 IS AN END MILL ) N270 G53 G00 Z0. ( RESTART TOOL #01 HERE ) N280 G53 G00 X-20. Y0. N290 T1 M06 N300 S#620 M03 N310 #618= #608 N320 #627= #607 N330 #624= [ COS[ #608 ] * #613 ] N340 #625= [ SIN[ #608 ] * #613 ] N350 G54 G00 G90 X#624 Y#625 N360 G43 Z#611 H01 D01 M08 N370 WH [ #627 GT 0 ] DO1 N380 G00 X#624 Y#625 N390 Z [ #610 + 0.1 ] N400 M97 P500 N410 #627= [ #627 - 1 ] N420 #618= [ #618 + #609 ] N430 #624= [ COS[ #618 ] * #613 ] N440 #625= [ SIN[ #618 ] * #613 ] N450 END1 N460 G53 G00 Z0. M09 N470 G53 G00 X-20. Y0. ( UNLOAD HERE ) N490 M30 N500 ( START OF HOLE MILLING CYCLE ) N510 G01 Z#610 F#601 N520 G13 G91 Z#604 I#616 K#612 Q#617 L#605 N530 G90 N540 G00 Z#611 N550 M99 % |
| Sponsored Links |
|
#6
| |||
| |||
| Probing is an something that can't be done without macros. If you want to add proximity switches to fixtures to verify that a part is loade correctly you will need a macro. If you want a fully automated tool setting system with a CNC Presetter and baluff tool tags you will need macros. If you have need to make a parabola on a lathe use a macro. There are some expamples on www.programmingunlimited.com. Also look at the tips and tricks page. There are a lot of uses for macros, they are not just a through back to the old days. Michael |
|
#7
| |||
| |||
| CJH, I'm just starting out in CNC adventure on a Haas with macro. . . . so if your question made people fall out of their chairs laughing my answer will probably do the same for them as well. . . . Anyway, so I am just starting out and man, there so many variables involved in machining. . . . surface speed, chip load, and the rest. The end mills come with recommended value but I'm told that I should start with more conservative values. I have one RPM setting per tool but has a variety of feed depending on plunge, profiling and slotting, sprinkled all over the program. Using the simplest variable definition available with macro, I group my feed rates and define them in the beginning of the program so I can easily change them as I experiment with the feed speed. Probe package simplifies tools length and parts offset for a newbie like me, and like rikosintie mentioned, probing is done through macro. |
|
#8
| ||||
| ||||
| Wether or not many of us use macros in actual part programs, they are the power behind Visual Quick Code. I've really been digging into my Lathe VQC and tailoring it to my shop's needs. I'll never have to calculate thread depth or convert metric to inches again. (keeps work interesting.) In my opinion, they surely aren't neccessary for day to day machining, but when understood and used in the right circumstance, they save lots brainwork and data entry and prevent mistakes.
__________________ Jet engine is next! http://www.floridaame.org/GalleryPages/g1m0186.htm |
|
#9
| |||
| |||
| Chi-Town CNC; If you want to share some of those I will put them up on the Tips page at www.programmingunlimited.com Michael |
![]() |
| 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 |
| Help with macros | afterburn25 | Haas Mills | 4 | 04-09-2007 09:19 AM |
| Macros in Autocad2006 LT | gatorman | Visual Basic | 6 | 06-30-2005 03:58 PM |
| Macros | cncfreak | General CAM Discussion | 24 | 05-06-2005 06:04 PM |
| macros | toyoda | General CAM Discussion | 0 | 05-30-2004 05:56 AM |
| Macros | MachineSMM | General CAM Discussion | 2 | 06-20-2003 01:41 PM |