584,808 active members*
5,158 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Okuma > please, help with local variables
Page 1 of 2 12
Results 1 to 20 of 30
  1. #1
    Join Date
    Jun 2015
    Posts
    4131

    please, help with local variables

    hello, there is a program, delivering different result on mill vs lathe .

    please, is there a way to make machines behave the same ? kindly !

    Code:
    [lathe]
    DIA1=10
    DIA2=20
    
    
    CALL OS02
    
    
    V3=DIA1
    V4=DIA2
    
    
    M02
    
    
    OS02
    
    
    DIA1=100
    DIA2=200
    
    
    V1=DIA1
    V2=DIA2
    
    
    RTS
    
    
     ( V1=100 )
     ( V2=200 )
     ( V3=100 )
     ( V4=200 )
    Code:
    [ mill ]
    DIA1=10
    DIA2=20
    
    
    CALL OS02
    
    
    VC3=DIA1
    VC4=DIA2
    
    
    M02
    
    
    OS02
    
    
    DIA1=100
    DIA2=200
    
    
    VC1=DIA1
    VC2=DIA2
    
    
    RTS
    
    
     ( V1=100 )
     ( V2=200 )
     ( V3=10  )
     ( V4=20  )
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  2. #2
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    can i use global variables on mill, as on lathe ?
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  3. #3
    Join Date
    Jun 2008
    Posts
    372

    Re: please, help with local variables

    Lathe is V100 mill is VC100

  4. #4
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    Lathe is V100 mill is VC100
    hy, this thread is about local variables, not common variables, like the ones from your post if you wish, please check attached file ...
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  5. #5
    Join Date
    Jul 2010
    Posts
    287

    Re: please, help with local variables

    Quote Originally Posted by budgieW View Post
    Lathe is V100 mill is VC100
    You can also use:
    Mill: VC[100]
    or
    Lathe: VC[100]

    The lathe iteration is the correct result, but you are having read ahead issues.
    Run the mill in single block, check your result. I'd wager it'd match the lathe.

    Add:
    TIME=VDIN[1001]

    As the first line in the mill sub program OS02

    Advise

  6. #6
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    hy teahole

    You can also use: Mill: VC[100] or Lathe: VC[100]
    ok ?!

    The lathe iteration is the correct result, but you are having read ahead issues
    so the lathe is slower on read ahead ? after latest trials, i can say that "lathe team" is delivering better stuff than "mill team"

    Run the mill in single block, check your result. I'd wager it'd match the lathe
    i will compare read ahead on bought cnc's, and also i will run the mill in single-block; if you are right, than i will .....

    TIME=VDIN[1001]
    you really have some stile with variables what does this one ? kindly !
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  7. #7
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    Mill: VC[100] or Lathe: VC[100]
    hy, VC[...] works on bought; also, i scanned my lathe documents, and there is no information about this; only a reference about "VC1" from where do you have all this tricks ? well, this one is not so huge, but still ....

    The lathe iteration is the correct result
    maybe the mill is the correct result ? i run the mill like this :
    ... single block
    ... buffer off
    ... TIME=VDIN[1001], but nothing changed ...

    on "single block", i had to press green button only 2..3 times to run the program, and thus, machine did not stop at each line; i think it is looking for a G code, and if there is nothing, than it jumps over more than 1 line

    however, thx for your suggestions
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  8. #8
    Join Date
    Jul 2010
    Posts
    287

    Re: please, help with local variables

    Quote Originally Posted by deadlykitten View Post
    hy, VC[...] works on bought; also, i scanned my lathe documents, and there is no information about this; only a reference about "VC1" from where do you have all this tricks ? well, this one is not so huge, but still ....

    maybe the mill is the correct result ? i run the mill like this :
    ... single block
    ... buffer off
    ... TIME=VDIN[1001], but nothing changed ...

    on "single block", i had to press green button only 2..3 times to run the program, and thus, machine did not stop at each line; i think it is looking for a G code, and if there is nothing, than it jumps over more than 1 line

    however, thx for your suggestions
    First, scanning your documents will not yield you what you're looking for. Most of my tidbits came from deep reading into manuals, old and new. It's amazing how much stuff existed on the old controls that never got used because nobody knew how/why you would and are detailed in older manuals, but not in newer ones. Usually i'm searching for a solution to some problem i'm having, and read about something and think: "that may be damn useful someday. I'll write it down". Then i write it down, what it does and keep an active running list. That's where i discovered how to do things like read current position on a mill in reference to current work offset, not machine position. How to reset mill common variables to "empty". How to do most of the things I now do without thinking that save a boat load of time. Can I get a hell yeah yee haw for same t call as current is made alarm D?

    Second, regarding the VDIN[1001], it was something that was given to me by an Okuma engineer some months ago. It will not stop on every line in single block with nothing but variables and as a result the program will keep reading them until it finds something else. TIME is setting a local variable to be named "TIME", and you're setting the value to VDIN[24]. Whatever that is at that moment. Id wager the addition of a G code would be correct. However, as another solution, to prove the lathe is correct or the mill is, add an M331 to the lathe before and after the CALL statement. Then, add, and I forget the exact number needed, so we'll guess high, 20 lines that read: G4F.01 before and after the call statement. I think if you were to add the VDIN[1001] with a single G4 it may do the same, but i don't have a mill available for quite a while to do any testing on myself. Sorry.

    As for "lathe team" vs "mill team", i disagree entirely.
    Frankly, I need a lathe and mill to do different things.
    I think the mills need to look ahead further and faster especially for things like HI-CUT PRO to work. It's following a shape, so there are thousands of little lines making that shape. NURBS if you will.
    On a lathe, typically you have a shape being cut, but one line may take 14 seconds to cut. Or more. So I may not want it to read ahead so far, so fast.

    But which ever.

    Lastly:
    VC[1]=3
    VC[VC1]=6
    Will yield values of 3 and 6 in V1, AND V3 respectively.
    In a mill it does the same thing for VC1 AND VC3.
    Makes it easier to use lathe and mill macros across the 2 controls. Been around for a long time. Nobody uses it.

  9. #9
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    hy teahole glad to see you ... please, i did not get it :

    It will not stop on every line in single block with nothing but variables and as a result the program will keep reading them until it finds something else >so by using "TIME=VDIN[1001]", than when running in single block machine will stop only on lines with variables ? and if this is true, than what is the purpose for this ?

    TIME is setting a local variable to be named "TIME", and you're setting the value to VDIN[24] > i am lost ... so lost : so a local variable may be initialized with VDIN[1001], and that local variable may be called TIME or LV01 ? and what happens next with the local variable ? this variable stores a value = VDIN[1001], but why does it store it, and for how long ?

    Id wager the addition of a G code would be correct > why would i add a G code ? when i input "TIME=VDIN[1001]", machine was jumping more than a "single line" in "single block", and i just supposed that it was looking for some G codes

    However, as another solution, to prove the lathe is correct or the mill is, add an M331 to the lathe before and after the CALL statement. Then, add, and I forget the exact number needed, so we'll guess high, 20 lines that read: G4F.01 before and after the call statement. I think if you were to add the VDIN[1001] with a single G4 it may do the same > so using "TIME=VDIN[1001]" has the same effect like :

    Code:
    M331
    CALL Oxyz
    M331
    G04 F 0.01 ( ~20 times ? )
    and the "effect" is ? you mean to delay the buffer ? to avoid the "read ahead" ? i remember you said this before here : http://www.cnczone.com/forums/okuma/...tructures.html

    i have allready disabled the "buffer reading" from machine parameters, and nothing changed ... thus, why would i try other techniques to disable "buffer / read ahead" ?
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  10. #10
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    Quote Originally Posted by tea hole View Post
    As for "lathe team" vs "mill team", i disagree entirely. Frankly ... So I may not want it to read ahead so far, so fast.
    i agree with you / when i said something about "lathe team" and "mill team" i was not reffering only to the situation described in this thread ( sorry for the confusion )

    in recent threads had been discussed some differences, more or less important, but is obvious that this differences exist and "lathe guys" should talk more with "mill girls"

    a major difference, for example. that i wrote in last post here : http://www.cnczone.com/forums/okuma/...tor-stuff.html, is that mill reaction time on "load monitor" is slow compared to lathe

    i think it would be a good idea to open a thread only for differences between these teams
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  11. #11
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    First, scanning your documents will not yield you what you're looking for
    i totally agree : this is way i don't read manuals when i search something, i select "inside files search" and choose all lathe or mill manuals, so i can scan pretty fast through all documentation with 1 click

    Most of my tidbits came from deep reading into manuals, old and new. It's amazing how much stuff existed on the old controls that never got used because nobody knew how/why you would and are detailed in older manuals, but not in newer ones. Usually i'm searching for a solution to some problem i'm having, and read about something and think: "that may be damn useful someday. I'll write it down"
    you know, one of us should RTFM yeah, i know, i know ...

    Then i write it down, what it does and keep an active running list.
    i have 3 main lists :
    ... one with issues about parts that i must craft
    ... one with Okuma cnc's issues
    ... one with issues about a more organized shop

    i need a programmer to handle 1st and 2nd lists, so i would focus on 3rd

    That's where i discovered ... how to reset mill common variables to "empty"..
    i have never reset a variable in this way; at this moment i don't even know why i would do so ...

    Can I get a hell yeah yee haw for same t call as current is made alarm D?
    i don't know what a D alarm does, but i can say that i handle this case with my tool change procedure : http://www.cnczone.com/forums/okuma/316654-forum.html

    ps : if you listen, you will hear me cheering for this / if you''ll keep it this way, you will get ( soon ) another Nobel prize



    .
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  12. #12
    Join Date
    Jul 2010
    Posts
    287

    Re: please, help with local variables

    Quote Originally Posted by deadlykitten View Post
    hy teahole glad to see you ... please, i did not get it :

    It will not stop on every line in single block with nothing but variables and as a result the program will keep reading them until it finds something else >so by using "TIME=VDIN[1001]", than when running in single block machine will stop only on lines with variables ? and if this is true, than what is the purpose for this ?
    No, this will not change that, but the purpose of the VDIN[####] is to force the control to wait to read ahead in a way that it is calculating variables and numbers ahead of time. If it has to record WHEN something happened, it cannot do it until that line is executed, thus it must wait on that line before calculating any further. It does not change how single block works

    TIME is setting a local variable to be named "TIME", and you're setting the value to VDIN[24] > i am lost ... so lost : so a local variable may be initialized with VDIN[1001], and that local variable may be called TIME or LV01 ? and what happens next with the local variable ? this variable stores a value = VDIN[1001], but why does it store it, and for how long ? [24] was a mistype. VDIN[24] is an end of bar signal in a lathe. Meant to type 1001. A local variable is initialized as you say as soon as you define it within a given program. So once TIME exists, I can check it's value. I can also check it's existence.
    O1234
    IF TIME N1234
    TIME=1
    VC1=TIME
    N1234
    RTS
    This will set VC1 to 1.
    O1234
    DAN=1
    IF DAN N1234
    TIME=1
    VC1=TIME
    N1234
    RTS
    This will set DAN to 1 and because DAN exists, skip TIME=1 and VC1=TIME, therefore, not changing it from its previous value.

    Id wager the addition of a G code would be correct > why would i add a G code ? when i input "TIME=VDIN[1001]", machine was jumping more than a "single line" in "single block", and i just supposed that it was looking for some G codes
    Let me see if I can get a mill for a minute to create a demonstration of what i'm trying to explain here.

    However, as another solution, to prove the lathe is correct or the mill is, add an M331 to the lathe before and after the CALL statement. Then, add, and I forget the exact number needed, so we'll guess high, 20 lines that read: G4F.01 before and after the call statement. I think if you were to add the VDIN[1001] with a single G4 it may do the same > so using "TIME=VDIN[1001]" has the same effect like :

    Code:
    M331
    CALL Oxyz
    M331
    G04 F 0.01 ( ~20 times ? )
    NO.

    (LATHE CODE)
    Code:
    M331
    CALL Oxyz
    M331
    (MILL CODE)
    Code:
    G04 F 0.01 ( ~20 times ? )
    CALL Oxyz
    G04 F 0.01 ( ~20 times ? )
    and the "effect" is ? you mean to delay the buffer ? to avoid the "read ahead" ? i remember you said this before here : http://www.cnczone.com/forums/okuma/...tructures.html

    i have allready disabled the "buffer reading" from machine parameters, and nothing changed ... thus, why would i try other techniques to disable "buffer / read ahead" ?
    dunno. I'm just trying to express the lathe is correct, and the mill is wrong based on the results you're reading and explain why.
    There's a difference between reading a program and executing a program. NC operation doesn't count a complete part until you run a part WITHOUT machine lock on, for example.
    I'm not sure how to explain this without a machine to do it on, if I can think of a way to do it.

  13. #13
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    the purpose of the VDIN[####] is to force the control to wait to read ahead in a way that it is calculating variables and numbers ahead of time
    so in this way, when a line with a formula/variables is reached, than it will be executed faster, because it had been calculated before ? far as i know, this is default behaviour on cnc's, because the read ahead buffer does it on it's own / so what extra-functionality does the VDIN ? is it somehow increasing/enhancing the read-ahead ?

    A local variable is initialized as you say as soon as you define it within a given program. So once TIME exists, I can check it's value. I can also check it's existence.
    ok, i understood your examples / also, at this point, i have no idea where or why i would use such examples

    Let me see if I can get a mill for a minute to create a demonstration of what i'm trying to explain here
    if you wish you may use an obelisk to travel near my location ( is a mill here ), but 1st you must achieve "okuma programmer rank = the traveller" ; such ranks are officialy released, but if you will trick this bureaucracy, than you may get disintegrated after entering the obelisk far as i know it doesn't hurt, but ...

    I'm just trying to express the lathe is correct, and the mill is wrong based on the results you're reading and explain why
    also i believe that the lathe is correct ; maybe there is a parameter / bit / something simple on the mill, but i don't know how to acces it

    however, all this started when i wished to export the result from a "soubroutine" to a "main program" ; this is what i have done so far :
    ... i give up using local variables, so i used a common variable instead, or
    ... i used a 4th kind variable; there are "common", "local" and "system variables" explained inside manuals ; and also 4th kind's, that i found inside msb files this are "local variables" that do not respect the syntax that is recomended to be used, thus they begin with "V", and normally it is not allowed to use local variables that begin with "V" ; like this i can export the result from a soubrutine that is written in a file, to a program that is written in another file so, this variable acts "global" not only inside a file, but also between files, just like a "common variable" ... i discovered this when tuning my renishaw

    such a thing requires caution, because the 4th kind variable was designed for a "purpose" ; so, when is used inside a program, than it must be done in such a manner that the "purpose" won't get affected / i know when the "purpose" occurs
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  14. #14
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    Code:
    LV = 100
    CALL OSUB
    VC1 = LV
    M02
    
     ( . . . . . . . . . . . )
    
    OSUB
        LV = LV + 1
    RTS
    when a local variable(=lv) is created before the CALL OSUB, and is edited inside the OSUB :
    ... lathes pass the "new value" to the lv, thus VC1 will be 101
    ... mills do not, thus VC1 will be 100

    question is which case is correct ? if you ask me, i would say the lathe, but there is no example inside the manuals to sustain mill or lathe behaviour. lv's are presented differently in mill and lathe manual.

    all examples from manuals are like a "lv" may be passes from the main to the sub, and again to other sub, but there is nothing about "coming back"

    by "coming back" i mean to perform some calculations inside a soubrutine, and after to pass the final result back to main program

    since i can not do it by using a local variable, i used instead other variable type, as shown in previous post, but still, this behaviour of local variables makes things safer for a "single way" usage, so only when passing arguments/values futher, to another soubrutine; there is no feedback ...
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  15. #15
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    hello, is it possible to visualize what local variables are registered, and with what values ?

    something like a "local variables list" ? kindly !
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  16. #16
    Join Date
    Aug 2011
    Posts
    418

    Re: please, help with local variables

    Quote Originally Posted by deadlykitten View Post
    hello, is it possible to visualize what local variables are registered, and with what values ?

    something like a "local variables list" ? kindly !
    I think it is not possible.
    "Imagination is more important than knowledge."

  17. #17
    Join Date
    Dec 2008
    Posts
    3110

    Re: please, help with local variables

    Quote Originally Posted by deadlykitten View Post
    hello, is it possible to visualize what local variables are registered, and with what values ?

    something like a "local variables list" ? kindly !
    You need to parse them back to the "user variables"
    ie VC1=lv
    then look at the "user variable" page

    Basically, you tend to only use the user variables ( V# or VC# ) for the reason that it is easier to trace faults

  18. #18
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    hello this days, while i was searching for something, i saw a table with local variables, like a printscreen from the cnc monitor ... i can not find that page again, and i wonder what was it about
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  19. #19
    Join Date
    Dec 2008
    Posts
    3110

    Re: please, help with local variables

    Quote Originally Posted by deadlykitten View Post
    hello this days, while i was searching for something, i saw a table with local variables, like a printscreen from the cnc monitor ... i can not find that page again, and i wonder what was it about
    You probably saw the list for "Reserved Local Variables" in the appendix section of the programming manual ( last section most likely )

  20. #20
    Join Date
    Jun 2015
    Posts
    4131

    Re: please, help with local variables

    Quote Originally Posted by tea hole View Post
    You can also use:
    Mill: VC[100]
    or
    Lathe: VC[100]
    hy teahole i had some simple counting variables V1=V1+1, and V2=V2+2, and i just remembered your post, so i finally wrote it like this :

    Code:
    OPP
    
     VC [ LV04 ] = VC [ LV04 ] + 1
    
    RTS
    so i increment those by CALL OPP LV04 =argument

    Makes it easier to use lathe and mill macros across the 2 controls. Been around for a long time. Nobody uses it.
    please, what type of macros / procedures do you use ? particular for a cnc or across ?

    i mean, if u have time, please ? i will create a thread about this; thank you
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

Page 1 of 2 12

Similar Threads

  1. Local variables
    By underthetire in forum Haas Mills
    Replies: 3
    Last Post: 07-02-2012, 09:36 PM
  2. Local Variables?
    By TURNER in forum NCPlot G-Code editor / backplotter
    Replies: 2
    Last Post: 03-03-2008, 01:25 PM
  3. local variables of a macro
    By sinha_nsit in forum Fanuc
    Replies: 8
    Last Post: 01-16-2008, 01:19 PM
  4. Local variables
    By jorgehrr in forum G-Code Programing
    Replies: 4
    Last Post: 02-19-2007, 10:03 PM
  5. G65 local variables help
    By FanukRC in forum G-Code Programing
    Replies: 7
    Last Post: 07-26-2006, 12:00 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
  •