Share your ideas and stories about how you have applied Custom Macro - or any version of CNC-related parametric programming. Ask questions, which I and others will try to answer. In general, improve your understanding of this helpful CNC programming tool!
Search
Hello, when using local variables are they stored somewhere? or does the macro just use them rite from the main call arguments? thanks
With FANUC CNC's, local variable registers can be displayed from the OFS/SET page then "MACRO" (with older controls it is from the SET page). Since they are only active when set in a program (cleared at M99 or M30), they will only show you values during the execution of a program that uses them.
For example, the command G65 P1000 A1.5 B3.0 C0.4 will set local variables #1, #2, and #3. Then program O1000 will be activated. #1, #2, and #3 will be active while O1000 runs, reset to vacant (blanked out) when the program ends with M99. While O1000 is running, you can monitor them from the MACRO page shown below.
Thank you, I thought they had to be somewhere, I'm not sure if this machine shows the local variables or not, seems like they start with the common 100's, I'll take a look on Monday. what do you know about the soft control screen, you know to turn things on/off, this one is Blank, it shows about 5 rows of the on/off but nothing in front of them? I would like to shut the chuck foot pedal off some times as I run big parts with a face driver and don't want to accidentally
drop a part when it's sitting with part still in machine. keep relays or maybe the ladder? thank's again, I have learned a lot from you over the years.
As for the local variables, you're right, the CNC starts by showing the common variable (#100 series). If you press the page up or cursor up key, you'll scroll into the local variables.
Not sure about the "soft control screen". Sound like a feature you need to ask your machine builder about - same for the ability to turn off the foot pedal for chuck open/close. There may be an easier way than going into the ladder logic, but I'd recommend that you ask someone from the machine tool builder.
Thank's Mike
I have another question, dont know if this is the rite spot but here goes, wrote a simple macro to keep track of a G53 Z position for a tail stock program on a cnc lathe, the problem is when it stores the number in a variable it goes way down in the decimal place like 1.2345678 and i want it to go to the 4th place 1.2345 like it shows on program check screen machine scale(G53). I tried to use the round and fix etc. but it would go to integer + or- I want it to be exact. this is what I'm using #501=#5022 and its a fanuc 21i TC thanks
While I think the CNC would automatically round to the four places in a CNC command (or at least not generate any kind of alarm), here is a technique that will truncate to a four place decimal format.
You can do this more concisely, but I break it up for clarity:
#100=#5022 * 10000 (1.2345678 becomes 12345.678)
#101=FIX[#100] (12345.678 becomes 12345.)
#501=#101/10000 (12345. becomes 1.2345)
Hope this helps.
That worked great! you are the king of macro! thanks Mike