585,973 active members*
4,165 visitors online*
Register for free
Login
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2013
    Posts
    7

    Macro b variable order

    Hello and thanks for any help in advance.

    I have been toying with writing macros on a Fanuc 21i Lathe Control. I wrote and tested a macro to perform incremental "Z" axis moves, should we have issues with strings and need to break chips during turning operations. A simulation in graphics and a full test run did as expected.

    My macro callup looks like this: (WITH VARIABLES IN NO PARTICULAR ORDER)

    G65 P8888 D(BLANK DIAMETER) X(FINISH DIAMETER) C(INC. Z CUT DEPTH) I(INC. Z RETRACT) Z(FINAL Z DEPTH) F(FEEDRATE) K(RAD. CUT ON DIAM) S(Z AXIS START POS.)

    These variables are for calculation reference only and do not change. This morning I decided to rearrange them so all the Diameter and "Z" axis values are in a more orderly fashion for an easier understanding as follows:

    From: G65 P8888 D X C I Z F K S
    To: G65 P8888 D X K S Z C I F

    Upon doing this all my numbers show up on the Local Variable page accordingly, however the "D" value is being completely ignored and replaced with the "I" value while "I" is being left blank. There is nowhere within the macro that these values are calculated to be altered. Changing it back resolves this issue. My understanding is that upon a G65 P####, the controls will read the variable values, place them in the Local variable page accordingly and then proceed to execute the macro. Why then would it ignore one value and replace it with another simply by rearranging the order? Am I missing something vital that would cause this?

  2. #2
    Join Date
    Jul 2010
    Posts
    118
    Hi,
    seems you have trigered the type 2 definition, see "Mixture of argument specifications I and II"

    looking at your definitions, the same result could also be achived with G74 including XPR.

  3. #3
    Join Date
    Aug 2013
    Posts
    7
    Thanks for your reply. I will have to look into this further as a google search brings up very little at the moment. I appreciate your input in using a G74 command. I had considered this and only didn't as a way to better understand macros and refine my skills.

  4. #4
    Join Date
    Aug 2013
    Posts
    7

    Smile Solved...

    Figured it out thanks to your feedback. I see now how it was assigning the value to "I2" which is variable #7 as opposed to just "I" #4. Variable "D" is #7 therefore it overwrote it that value. Thank you again.

  5. #5
    Join Date
    Feb 2006
    Posts
    1792

    argument specification

    "...Since the CNC uses the word address format, the arguments of
    G65/G66, including P-word and L-word, can be specified in any
    order (but no argument should appear to the left of G65/G66). However,
    I, J, and K, if used, must be specified alphabetically. Hence, for
    example, . . . K_ I_ . . . must be replaced by . . . I_ K_ . . ., otherwise
    it would be interpreted in argument specification II, changing the
    meaning completely."

    Read the attachment for more details.

Similar Threads

  1. Macro/Variable Programing
    By chadr03 in forum WinCnc
    Replies: 1
    Last Post: 02-02-2011, 02:00 PM
  2. Oi-TC add comments to macro variable table
    By nracingdev in forum Fanuc
    Replies: 11
    Last Post: 01-27-2011, 09:46 PM
  3. macro b local variable
    By samu in forum Fanuc
    Replies: 4
    Last Post: 12-19-2010, 12:55 AM
  4. Macro Variable Lock
    By James L in forum Haas Mills
    Replies: 2
    Last Post: 07-23-2009, 02:29 PM
  5. Macro variable example I programmed today.
    By theemudracer in forum G-Code Programing
    Replies: 1
    Last Post: 03-08-2007, 03:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •