Results 1 to 6 of 6

Thread: Are local variables "saved in memory"...

  1. #1
    Registered
    Join Date
    Jul 2007
    Location
    US of A
    Posts
    57
    Downloads
    0
    Uploads
    0

    Are local variables "saved in memory"...

    or do they become null or 0 value at end of program
    will OD retain a value after the m2% is read and cycle start is pressed
    so I can continue to use the calculated value of OD in different equations
    for example if in a program I have an equation
    ...
    IF [V28 EQ 0] N10
    OD=DFIX[V28/3.1416]+V29+V30
    V2=OD
    V28=0 V29=0 V30=0
    GOTO N20
    N10
    V2=PD-.2
    V3=OD
    N20
    ...
    or will I need to add a bunch of conditions before the m2, or learn more about scheduling or... who knows but it will be fun trying.
    CHEERS!
    I'm just a butcher masquerading as a machinist


  2. #2
    Registered Superman's Avatar
    Join Date
    Dec 2008
    Location
    Krypton
    Posts
    1,768
    Downloads
    0
    Uploads
    0
    You seem to be using a combination of "User Variables" (V#'s) and "Local Variables" (PD,OD etc )

    User variables ( V#= in lathes, VC#= in mills ) are stored to a designated area, switch the m/c OFF and ON, they are still there. You can also look at the actual value at any time
    but
    Local Variables are stored in ROM, now turn the m/c OFF and ON, and they're gone

    Try putting them into User Variables, you can step thru a program, and double check your calcs to those recorded

    Code:
     
    ...
    IF [V28 EQ 0] N10
    V1=DFIX[V28/3.1416]+V29+V30
    V2=OD
    V28=0 V29=0 V30=0
    GOTO N20
    N10
    V2= [V4 -0.2]
    V3=V1
    N20
    ...


  3. #3
    Registered
    Join Date
    Jul 2007
    Location
    US of A
    Posts
    57
    Downloads
    0
    Uploads
    0
    The problem I am having is I use 29 of my 32 available common variables and some of those have more than 1 function, the other 3 are used to output calculated equation values so we can double check ourself before cycling. Im plum outta common variables, and I want to avoid online program editing.
    The input I have been getting in this forum has been really helpful I have the actual g-code seperated from most of my local variables, and now we are building the local variable library, and most of the common variables get defined by the information in the local variable program along with at least 3 specific common variables. A lil crazy but I just got caught up in User Task

    Thanks S'more
    CHEERS!
    I'm just a butcher masquerading as a machinist


  4. #4
    Registered
    Join Date
    Apr 2009
    Location
    USA
    Posts
    494
    Downloads
    0
    Uploads
    0
    You could use local variables and just set them at the beginning of your program. You will have up to 128 of them available plus the 32 common variables. If you need more, reset them to new values part way through the program if need be.

    Will that work for you?

    Best regards,


  • #5
    Registered
    Join Date
    Jul 2007
    Location
    US of A
    Posts
    57
    Downloads
    0
    Uploads
    0
    Here is a little good news bad news scenario.. I have now learned how to store values from the program into tool data values via VTOFx/z and VNSRx/z
    now the bad news is I have learned this neat little trick since I am using that space now to store part values. This scares me a little... okay alot
    I fear one day in the future some poor soul will swap a tool station and cause some havoc.
    Our problem is when we reset the program in order to restart(usually for a taper correction) local variables seem to lose their value. I do hope to find another place to store these "local values" than in tool data , but since I am using tools 13-32 as local variables I think its unlikely someone that doesn't understand the prog/mach a little will define these offsets...being only a 12 tool turret.
    fun fun fun
    CHEERS!
    I'm just a butcher masquerading as a machinist


  • #6
    Registered broby's Avatar
    Join Date
    Apr 2006
    Location
    Australia
    Posts
    643
    Downloads
    0
    Uploads
    0
    "Local" variables live and die within the currently running program only.
    As soon as the program ends, so do the "local" variables.
    Storing "variable" information within tool offsets in my mind will only lead to many problems.
    When you say you only have 12 tools in the turret and you will not be using the other offsets, what about grooving tools? I have always used two sets of offsets to define each grooving tool. One set per side of the tool.
    At least you are aware that this could lead to disaster...


  • Similar Threads

    1. Fanuc OM "memory dump"
      By padobranac in forum Fanuc
      Replies: 15
      Last Post: 02-02-2012, 01:11 AM
    2. Need Help!- "Memory Card Error 121"
      By pdubya_CNC in forum Commercial CNC Wood Routers
      Replies: 1
      Last Post: 04-21-2011, 04:58 AM
    3. Need Help!- memory card error "1010"???
      By spock in forum Fanuc
      Replies: 6
      Last Post: 08-13-2010, 09:10 AM
    4. How to find local machines shops? 'Ooops I meant "machine guys")
      By FXC in forum DIY CNC Router Table Machines
      Replies: 3
      Last Post: 11-22-2009, 10:09 PM
    5. Help understanding "variables" and others.
      By keithorr in forum CamSoft Products
      Replies: 27
      Last Post: 05-09-2005, 01:54 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.