584,850 active members*
4,465 visitors online*
Register for free
Login
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Posts
    150

    Local Variables?

    Hi Scott,
    Possibly another problem with local variables, they seam to clear on M99, but this does not happen on the m/c.
    Is this set on a parameter on the m/c?
    %
    O0001(NCPLOT CLEARING VARS ON M99)
    G65P2A10.B20.
    (NEXT LINE SHOULD MOVE TO X30.0 )
    ( BUT GOES TO X20.0 AS #1 HAS BEEN CLEARED )
    G0X[#1+20.0]
    M30
    O0002
    G21G55G17G0
    T1M6
    G40G0X0.Y0.
    Z2.
    X#1Y#2
    M99
    %
    thanks
    Turner.

  2. #2
    Join Date
    Mar 2003
    Posts
    765
    Hi Turner,

    It seems odd that your control *wouldn't* clear the local variables on M99. The reason that they are called "local" variables is because they are only valid for the sub that they are used in. Say for example your program O0001 used variable #3 as a loop counter. Let's also say that your program O0002 also used variable #3 for something. The idea is that program O0002 can use this variable *without* disturbing the value of #3 that program O0001 is using. So after the M99 in O0002, the value in #3 that program O0001 sees is the same is it was before the subprogram call, even if program O0002 also used #3.

    What control are you seeing this on?

    Thanks,
    Scott

  3. #3
    Join Date
    Dec 2004
    Posts
    150
    Quote Originally Posted by MetLHead View Post
    Hi Turner,

    It seems odd that your control *wouldn't* clear the local variables on M99. The reason that they are called "local" variables is because they are only valid for the sub that they are used in. Say for example your program O0001 used variable #3 as a loop counter. Let's also say that your program O0002 also used variable #3 for something. The idea is that program O0002 can use this variable *without* disturbing the value of #3 that program O0001 is using. So after the M99 in O0002, the value in #3 that program O0001 sees is the same is it was before the subprogram call, even if program O0002 also used #3.

    What control are you seeing this on?

    Thanks,
    Scott
    Sorry you are right, i was wrong. The control does not clear on M99, it was a new program i was writing and testing in NCPlot, we had previously been using common variables shared between subprogs, i was trying a new method using G65 and only passing the variables needed for certain changes. Ive not used local variables before and wasnt aware that they had levels for each prog. Never mind, Ive learned somthing new anyway.
    Turner

Similar Threads

  1. local variables of a macro
    By sinha_nsit in forum Fanuc
    Replies: 8
    Last Post: 01-16-2008, 01:19 PM
  2. Local variables
    By jorgehrr in forum G-Code Programing
    Replies: 4
    Last Post: 02-19-2007, 10:03 PM
  3. any Australians in here with local suppliers
    By dave05 in forum DIY CNC Router Table Machines
    Replies: 6
    Last Post: 09-05-2006, 11:00 PM
  4. G65 local variables help
    By FanukRC in forum G-Code Programing
    Replies: 7
    Last Post: 07-26-2006, 12:00 AM

Posting Permissions

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